[SPAM] [mod_python] [SPAM] Setting a variable

Richard Lewis richardlewis at fastmail.co.uk
Tue Jul 18 11:12:02 EDT 2006

On Tuesday 18 July 2006 15:56, Gregory Jones wrote:
> Hello all,
> I had a quick question. I come from the mod_perl world to the mod_python
> world. I am really enjoying mod_python and wanted to thank everyone who
> has put all the work into it. It is fun! Now, on to the question. I am
> curious how to set a variable inside the httpd.conf file. In mod_perl I
> could use PerlSetVar and then call that variable inside perl.
> Example:
> PerlModule My::Module
> <Location /module>
>     PerlSetVar my_variable 'variable value' ### This is what I am
> looking for
>     SetHandler perl-script
>     PerlHandler My::Module
>     PerlSendHeader Off
> </Location>
I do this:

Apache configuration includes:

SetVar my_variable 'variable value'

Handler script includes:

def handler(req):
  env_dict = req.subprocess_env

  val = env_dict['my_variable']

Richard Lewis
Sonic Arts Research Archive
JID: ironchicken at jabber.earth.li

More information about the Mod_python mailing list