misc: fix ezt [is ...] usage with lazy field variables (#27781)
This commit is contained in:
parent
735058211a
commit
fb712e7743
|
@ -722,6 +722,14 @@ def test_lazy_templates(pub, variable_test_data):
|
|||
tmpl = Template('{{form_user_name_identifier_0}}')
|
||||
assert tmpl.render(context) == pub.user_class.select()[0].name_identifiers[0]
|
||||
|
||||
def test_lazy_ezt_templates(pub, variable_test_data):
|
||||
context = pub.substitutions.get_context_variables(mode='lazy')
|
||||
tmpl = Template('[form_var_foo_foo]')
|
||||
assert tmpl.render(context) == 'bar'
|
||||
|
||||
tmpl = Template('[is form_var_foo_foo "bar"]HELLO[else]BYE[end]')
|
||||
assert tmpl.render(context) == 'HELLO'
|
||||
|
||||
def test_form_digest_date(pub):
|
||||
formdef = FormDef()
|
||||
formdef.name = 'foobar'
|
||||
|
|
|
@ -536,7 +536,7 @@ class Template:
|
|||
((left_ref, right_ref), t_section, f_section) = args
|
||||
try:
|
||||
value = _get_value(right_ref, ctx)
|
||||
value = string.lower(_get_value(left_ref, ctx)) == string.lower(value)
|
||||
value = string.lower(str(_get_value(left_ref, ctx))) == string.lower(str(value))
|
||||
except UnknownReference:
|
||||
value = False
|
||||
self._do_if(value, t_section, f_section, fp, ctx)
|
||||
|
|
Loading…
Reference in New Issue