On Tue, Aug 25, 2009 at 8:35 PM, Dennis Fogg<dennisf...@gmail.com> wrote: > PS: more succinctly: status notifications can happen in many places and > passing the session to all these places just for the status notification > does not make the code any clearer. Thus, I just want to access the session > as a global variable -- how can I do that? >
Sending messages to an user is very much tied to the current request -- only the current request can tell you which user is active currently, so whatever way you choose to store and retrieve notifications (database, sessions etc) you always need the request object in one way or the other. Really, there is a reason why Django does not provide global (or thread local) request / user objects. If you still want do do it, google for "threadlocals user", but I'd advise against doing that. In the end, it's your decision though. Btw, I've used this thread locals hack in the past, and it served me well for some time. It came back to bite me though, and I wish I hadn't used it; it really makes writing a testsuite a pain; dumpdata does not work because the manager of a single model depends on a thread local request object with an authenticated user etc. It's much better to cope with the need of having to pass the request around than pick up the pieces afterwards when choosing the simple path now. Matthias -- FeinCMS Django CMS building toolkit: http://spinlock.ch/pub/feincms/ --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---