On Wed, Oct 14, 2009 at 8:24 PM, Luke Plant <[email protected]> wrote:
>
> I want to fix #6552 (also #12031), and I've attached a patch that
> makes the auth context processor lazy.
>
> I'm pretty sure this is the right thing to do, but I'd like to check
> for any gotchas people might be aware of.

I can't see any obvious gotchas. Some comments follow:

> Some behavioural changes:
>
>  * user.get_and_delete_messages() will not be run if the page template
> doesn't iterate over 'messages'.  If you had a view which set some
> messages, followed by a template (that used RequestContext) which
> didn't display messages, it would silently delete messages.  Now,
> those messages will be displayed at a later point.  I think this is a
> bug fix, not a problem.

If I'm not mistaken, there's actually another bug lurking in that hole
- if you make two calls to render a template in the same view - for
example, if you use a RequestContext to render an email - the second
rendering (which will usually be the user-visible view) won't have any
messages.

>  * the output of {{ user }} in a template will be different.  I think
> this is acceptable, because only things like {{ user.username }} are
> actually useful, apart from when debugging.

I disagree. User.__unicode__() returns self.username, so {{ user }} is
a potentially useful (albeit non-specific) rendering technique for
user.

My only other comment is about ContextLazyObject - is this really
something that is specific to Context objects? Although we don't have
any other use for it right now, it strikes me as a more general
functional utility for deferring access to an object, rather than
something specific for templates.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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