>> Why not store the request
>> object (in a thread safe way) on module level?
...
> The biggest con is encourages bad design practices, the way Python works is
> you have a global and local scope, if you want something in your local scope
> you pass it to it.
> 
> If you really want to have the request object stored you can write a custom
> middleware to do it, but I wouldn't.

I don't want to enable this for all parts. Just for a single, complex form.

{{{
class MasterForm(object):
    ... contains several sub forms which need request

class SubForm(form.Form):
    def clean(self):
        if threadlocal.request.user .....

threadlocal=threading.local()
def view(request):
    threadlocal.request=request
    mform=MasterForm()
}}}



-- 
Thomas Guettler, http://www.thomas-guettler.de/
E-Mail: guettli (*) thomas-guettler + de

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

Reply via email to