I have written a new tag "add_data", which (if i break it down) does
only store some data, that it gets passed or generates (in the example
below it gets the data from the template, for easier demonstration)

{% add_data "one" %}

{% for u in users %}
    {% add_data "two" %}
{% endfor %}

{% add_data "three" %}


{% print_all_data %}


Finally the "print_all_data" tag will only contain:
     "one" and "three", NOT "two"
Is that correct? Is the django template scope supposed to work like that?

The "add_data" adds the data to the context inside the render()
function of the tag. Here lies the problem, the scope of the for loop
gets destroyed when the for loop ends (see the pop() function here
http://code.djangoproject.org/browser/django/trunk/django/template/context.py#L10
which is called within render() here
http://code.djangoproject.org/browser/django/trunk/django/template/defaulttags.py#L60


-- 
cu

Wolfram

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" 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/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to