Thanks again, Malcom -- I see what you mean, you're quite right. I do
keep forgetting that things are passed by reference, and that
definitely explains it - it also explains why the data corruption
limits itself to individual URL files (i.e. in this particular
instance, I only saw 'extra' info belonging to another handful of
views -- all of them originating in the same urls.py and therefore
sharing the same base info_dict object).

So I'll re-examine how I'm doing things with that in mind, and play
around with the deepcopy module if necessary, and that should make the
solution clear.

Regards,
Jeff

On Mar 15, 3:43 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Thu, 2007-03-15 at 15:10 +0000, Jeff Forcier wrote:
> > Oh, one more thing - here is one of the views whose data appears to be
> > getting mixed up with the one I showed in the previous email, for
> > reference:
>
> > ### views/engagements.py
>
> > def conflicts(request,**kwargs):
> >     kwargs['extra_context']['object_list'] = cases.get_list()
> >     kwargs['extra_context']['no_javascript'] = True
> >     return base.render_with_roles(request,**kwargs)
>
> Only noticed this after just replying, but it's entirely consistent with
> what I said. You cannot do this and expect it to work. Make a deep copy
> of the kwargs dict first, update that and pass that along:
>
>         import copy
>         new_kwargs = copy.deepcopy(kwargs)
>         new_kwargs['extra_context']['object_list'] = ..
>
>         # etc
>
> Note that copy.deepcopy() is needed here to get a genuinely new instance
> of the 'extra_context' dict. You can verify that by playing around at
> the Python prompt (which I often have to do in order to get this sort of
> thing completely correct). :-)
>
> Regards,
> Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to