[mod_python] environment settings

Graham Dumpleton grahamd at dscpl.com.au
Wed Feb 1 18:23:06 EST 2006

Robert Brewer wrote ..
> Graham Dumpleton wrote:
> > Nic Ferrier wrote ..
> > > Does SetEnv apply to mod_python code?
> > 
> > It does not insert it into "sys.environ" if that is what you 
> > are expecting.
> > The value will be found in "req.subprocess_env" though.
> But note that apache.build_cgi_env overwrites SCRIPT_NAME, for example
> (re-creating it from req.uri and req.path_info). There may be other
> special cases like that--the fastest way to find out is to test. ;)

>From memory, apache.build_cgi_env() is only relevant if you are using
mod_python.cgihandler. It doesn't come into play for normal request
handlers, mod_python.publisher or mod_python.psp.

The way that apache.build_cgi_env() sets SCRIPT_NAME is also potentially
broken. See:



More information about the Mod_python mailing list