[mod_python] How does mod_python handle concurrency?

Damjan gdamjan at mail.net.mk
Fri Sep 5 16:18:51 EST 2003


> We currently use time.strftime() in our CGI code after setting the TZ 
> environment variable to the user's timezone.  Since I'm trying to move 
> us away from the mod_python.cgi_handler to our own custom handler, in 
> order to allow concurrent request handling, I was wondering how to get 
> around the problem of having to update the TZ env var.

Setting environment variables in multithreaded/concurent programs 
is ugly.
I would suggest a different approach for your problem..
t = time.gmtime() # get the UTC time tupple
t = t[:-1] + (TZ,) # set the TZ field of the tupple
time.strftime(format,t) # get the strftime of that 


Also glibc as of 2.3 has a new multithreaded locale API, it doesn't 
depend on global variables. This would be great (and indead is designed
for) for multithreaded application servers like Apache.
Unfourtenatelly I don't know that python bindings for this API exists or
if at all anyone is working on this...

> This dependency seems to be a problem for concurrent request 
> processing.  Does anyone on this list have a trick for doing locale 
> specific date formating while handling concurrent requests?
> http://mailman.modpython.org/mailman/listinfo/mod_python

-- 
Damjan Georgievski
jabberID: damjan at bagra.net.mk


More information about the Mod_python mailing list