Use middleware to set a threadlocal variable in a global namespace on request, and unset it on response. -- Michael <mhall...@gmail.com>
On Fri, 2010-10-22 at 09:35 -0700, Jop wrote: > Hello all, > > I've been googeling for a while but haven't been able to find a > solution for my problem. I will try to describe the problem > > I want to be able to set a variable in a view function on the start of > the request. During the same request i want to use the variables value > in a manager method. > > Originally I thought about using a session because I can import the > session object anywhere, but I want the value to be reset after the > request is closed. I also though about trying to define a 'setting' > during runtime, though this seems to be -not done-. > > I have the feeling there must be a real simple solution, but I can't > seem to figure it out. > > Any ideas? > > Thanx a lot! > > Jop > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.