I am pretty sure that the following code
{% set m = { 'attribute': 'value' }%}
{{ 'yes' if m.attribute == 'value' else 'nope' }}
{{ 'yes' if m.not_an_attribute == 'value' else 'nope' }}
used to print
yes
nope
But since I updated to 2022.5 it seems to produce an error:
UndefinedError: 'dict object' has no attribute 'not_an_attribute'
Is this expected? Am I mistaken? What’s the cleanest way to achieve the desired result with the least amount of code? Is this the least verbose way to guard against undefined attributes?
{% set m = { 'attribute': 'value' }%}
{{ 'yes' if m.attribute == 'value' else 'nope' }}
{{ 'yes' if m.not_an_attribute is defined and m.not_an_attribute == 'value' else 'nope' }}
Thanks!