I run into problem with variable scope again.

As i know, there is no solution for this, only some "hacks":
http://stackoverflow.com/questions/17925674/jinja2-local-global-variable
http://stackoverflow.com/questions/4870346/can-a-jinja-variables-scope-extend-beyond-in-an-inner-block

In my last work i need to parse request related data and define some css 
classess and refs for output.

This is done in for loop whith various if operators. But if i setup 
variable prod_ref, for example, there is no chance to catch prod_ref value 
later (outside) for output.

So i need to put all output inside for loop with ugly construction:

    {# Ugly hack. If we make it out of 'for' loop we'll lost all variables: 
id_class, title_ref, etc, Do output in last step of for loop. #}
    {% if scount == loop.index  %}
      ... output...
    {% endif %}

Is there any solution or is there any plan to solve this (something like 
'global' operator)?

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pocoo-libs.
For more options, visit https://groups.google.com/d/optout.

Reply via email to