[mod_python] Global, but threadsafe request object?

Nicolas Lehuen nicolas.lehuen at gmail.com
Thu Sep 15 01:52:12 EDT 2005

The only way to do this safely and in a portable way would be to store the 
request object in a thread-local variable (see 
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/302088 ). Thread 
locals are only present in Python 2.4, though (but a pure Python 
implementation is provided and nothing prevents it from running on previous 
versions of Python).


2005/9/14, Fabiano Sidler <fabianosidler at swissonline.ch>:
> Hi folks!
> In a web application I planning I need to access the request object from a 
> big
> number of functions and classes. Therefore I could pass it each time to 
> each
> of the objects working on it, which has very ugly disadvantages like 
> inherent
> portability loss and weird parameter lists. So my question to you: Is 
> there a
> way to make it global-like, if necessary over a singleton-like wrapper 
> class
> returning it? I know, this looks more likely a python problem than a 
> modpython
> one, but perhaps someone here knows a simple solution with using mod-
> python specific code?
> Greetings,
> Fips
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050915/705b8d43/attachment.html

More information about the Mod_python mailing list