Adrian Holovaty wrote:
> Thanks for bringing this up, Gary. The get_and_delete_messages() thing
> has always bothered me -- if it's activated, we do it for every
> request. I suppose we could make the 'messages' part of the context
> processor lazy, so that it would only call get_and_delete_messages()
> if that variable were accessed in the template... Thoughts?

We could make the messages part lazy, but we also don't want to have to
pass it request.user because that defeats the purpose of LazyUser.
What if we gave the LazyUser class a lazy "messages" property and dont
pass a "messages" context variable in the context processor.  The
templates would instead access messages through the "user" context
variable.  Of course, this would make the templates backwards
incompatible.  As far as Django code, the messages variable seems to
get used only in contrib/admin/templates/admin/base.html.

I think it would be a good idea to add some re-usable Lazy object class
to Django, something like this:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/363602
This lazy loading stuff is a common scenario.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to