[mod_python] How does mod_python handle concurrency?

Dustin Mitchell dustin at ywlcs.org
Thu Sep 4 18:40:27 EST 2003

On Thu, Sep 04, 2003 at 04:12:39PM -0600, Guy Davis wrote:
> 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.

If you can look up the time zone offset, you can adjust the timezones
by simply adding the required number of seconds.  I know this isn't a
very good solution, but it's what I use for the small stuff I do.

I would be very interested in how you determine the user's locale?  Is
there any trick to interpreting request headers? Or is it a user
prefererence for your site?

> Also, does concurrent request processing in mod_python rely on a single 
> Python process with multiple threads?  If so, are sys.exc_type and 
> sys.exc_value shared between threads?  I'm on Apache 1.3 now but hope to 
> move to Apache 2 soon.

Yes, those values are explicitly shared between threads, which is the
reason for the creation of sys.exc_info().  See 




  Dustin Mitchell
  dustin at ywlcs.org/djmitche at alumni.uchicago.edu
  PGP Key: http://people.cs.uchicago.edu/~dustin/pubkey.txt

More information about the Mod_python mailing list