Closed
Description
I've noticed this while working on #1833
When the template panel gets an object implementing __repr__
, it might lead to triggering a SQL query:
The problem is that saferepr(value)
is used for testing, while value
is used for the actual assignment.
For example, with SimpleLazyObject
, the __repr__
returns <SimpleLazyObject: <function <lambda> at 0x7fe8ccb9dca0>>
, but later temp_layer[key] = value
causes the query to be executed. This particular case will be addressed by #1833.
Using saferepr
was introduced in 06bafad via #1076 to address other side effects of evaluating.
To make this code consistent, it should evaluate the value just once and use that later in the assignment.
Metadata
Metadata
Assignees
Labels
No labels