#3529: Context.update doesn't do what it says it does
---------------------------+------------------------------------------------
Reporter: SmileyChris | Owner: adrian
Status: new | Component: Template system
Version: SVN | Resolution:
Keywords: | Stage: Design decision needed
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
---------------------------+------------------------------------------------
Comment (by [EMAIL PROTECTED]):
I made this exact change to the Context patch when I wrote my own patch to
the {% for ... in ... %} tag. I checked then for occurences in
Context.update in the django source and the only one I found was in
django.template.loader, function render_to_string(), line 103. With this
patch this should be adapted slightly so that the context_instance
parameter of the function doesn't get polluted with the context of
dictionary. In fact as it is this function seems buggy as it changes the
value of the parameter context_instance if it is not None.
I didn't find any other reference to Context.update().
Another point: I think that the list Context.dicts is the wrong way round.
Lists in python are designed so that it is easy to add or remove elements
at the end, not at the front. So the current context should be
Context.dict[-1], popping a context then should be Context.dict.pop(), and
pushing a context should be Context.dict.append(new_dict). As it is every
time a context is pushed or popped, the whole context list (Context.dicts)
has to be rebuilt.
Sorry if this is not the right place to make theses comments.
--
Arnaud
--
Ticket URL: <http://code.djangoproject.com/ticket/3529#comment:2>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---