Hi,
I'm trying to understand & solve a template compiler problem.
Templates in this form:
{% if b %}
{% set a = 0 %}
{% endif %}
{% if a ==1 %}
fail
{% else %}
ok
{% endif %}
cause an UnboundLocal error in some cases, because they compile to:
def root(context, environment=environment):
l_b = context.resolve('b')
if 0: yield None
if l_b:
if 0: yield None
l_a = 0
context.vars['a'] = l_a
context.exported_vars.add('a')
if l_a == 1:
if 0: yield None
yield u'fail'
else:
if 0: yield None
yield u'ok'
blocks = {}
debug_info = '1=8'
"a" is considered assigned, not undeclared, but if b is false or
undeclared, a is never initialized. I think it should be coming
through as undeclared in that case, but I don't know enough about the
compiler to know how to make that happen.
Any ideas?
Thanks,
JP
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pocoo-libs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pocoo-libs?hl=en
-~----------~----~----~----~------~----~------~--~---