[mod_python] SetEnv and add_common_vars()

Gregory (Grisha) Trubetskoy grisha at modpython.org
Sun Jan 11 23:27:12 EST 2004


On Sun, 11 Jan 2004, Edwin Grubbs wrote:

> On Fri, Jan 09, 2004 at 07:48:39PM -0500, Gregory (Grisha) Trubetskoy wrote:
> >
> > On Fri, 9 Jan 2004, Edwin Grubbs wrote:
> >
> > > When I use SetEnv in my apache conf file, it causes a lot of the
> > > environment variables (such as DOCUMENT_ROOT) to disappear that
> > > add_common_vars() normally would set.
> >
> > When you say "dissapear" - what are you using to look them up?
>
> I am accessing the environment through the req.subprocess_env
> dictionary.
>
> > > The only workaround I have is to put the SetEnv statements in a
> > > different <Directory> block than the directory with the files served by
> > > mod_python.
> >
> > What is the objective here? If you are you trying to pass information to
> > mod_python from the config, a better way is to use PythonOption.
>
> The objective is to access the environment variables that are unique to
> each request such as REMOTE_ADDR, HTTP_USER_AGENT, and our own cookies
> such as SESSION_COOKIE.
>

Hmm... This may be a bug somehwere, I'll have to take a look at it. But,
all of this information is available directly without having to use
subprocess_env, as part of the request object or req.headers_in.
Subprocess_env is an inefficient way of doing it since it is artificially
constructed from the same sources to which mod_python allows you direct
access.

Grisha


More information about the Mod_python mailing list