[jinja2-2.5.5]
Hi,
the following Jinja2 template code:
{% set last_i = -1 %}
last_i={{last_i}} <br />
{% for i in range(3) %}
i={{i}} <br />
{% set last_i = i %}
last_i={{last_i}} <br />
{% endfor %}
last_i={{last_i}} <br />
renders to:
last_i=-1
i=0
last_i=0
i=1
last_i=1
i=2
last_i=2
last_i=-1
That is, the assignments in the for loop are local to the for-loop
scope. Although the variable was first initialized in the outer scope.
I wouldn't expect this. Normal behaviour??
What can i do to get the last value of last_i to the outer scope?
regards,
Lars R.
--
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.