You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using repeaters where the repeater object is specified using square brackets, by for example @{example_state_object[sub_object]}, Evaluator.evaluate_field() in core.py raises an error because the string passed to json.loads(replaced) does not contain valid json. This is caused by the regular expression not recognising the square brackets.
The use case where specifying the repeater object using square brackets is for instance with nested repeaters where a child repeater object needs to be specified by either the key or value of a parent repeater object.
This can be fixed by changing the regex line in the Evaluator class in core.py from: template_regex = re.compile(r"[\\]?@{([\w\s.]*)}")
to template_regex = re.compile(r"[\\]?@{([\w\s.\[\]]*)}")
to allow the recognition of square brackets.
I have tested that this fix actually resolves the issue, but I don't know whether it introduces any risks or other side effects.
The text was updated successfully, but these errors were encountered:
Thanks for spotlighting this issue and offering a solution — it is most appreciated!
Upon examination, your proposed fix seems clear of risks or side effects. The square brackets are indeed anticipated within the expression and are processed accordingly by parse_expression later on.
I'd suggest that you submit a PR, to highlight your contribution. However, if you'd prefer not to, I could do it on your behalf, just let me know!
When using repeaters where the repeater object is specified using square brackets, by for example
@{example_state_object[sub_object]}
, Evaluator.evaluate_field() in core.py raises an error because the string passed tojson.loads(replaced)
does not contain valid json. This is caused by the regular expression not recognising the square brackets.The use case where specifying the repeater object using square brackets is for instance with nested repeaters where a child repeater object needs to be specified by either the key or value of a parent repeater object.
This can be fixed by changing the regex line in the Evaluator class in core.py from:
template_regex = re.compile(r"[\\]?@{([\w\s.]*)}")
to
template_regex = re.compile(r"[\\]?@{([\w\s.\[\]]*)}")
to allow the recognition of square brackets.
I have tested that this fix actually resolves the issue, but I don't know whether it introduces any risks or other side effects.
The text was updated successfully, but these errors were encountered: