I have used threading.local as a base class for years in heavy production
use with no problem.  We use it for database connections, etc...  mod_wsgi
will never try to send two requests to the same thread at the same time, so
it is quite safe.

Keep in mind that if you derive a class from threading.local, the __init__
method will be called once per thread.  Just FYI.

Hope this helps.
JG

On Fri, Apr 27, 2012 at 3:40 PM, Frederik Vogelsang <
[email protected]> wrote:

> Hello everyone.
>
> I am working on a Django application which is served through Apache
> and mod_wsgi.
> We need access to the user object in models (without Django's usual
> request.user context). I am planning to use threading.local() for
> this. Is there anything to look out for when doing this? Is this even
> save? It would be a severe issue if a request's thread-local data
> could be destroyed/overwritten by another (maybe parallel) request,
> this is why I am asking.
>
>
> Kind regards,
>  Frederik
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" 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/modwsgi?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" 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/modwsgi?hl=en.

Reply via email to