quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Gallacher <jg.li...@sympatico.ca>
Subject PythonSessionOption - a new apache directive for session configuration
Date Sun, 12 Jun 2005 20:49:55 GMT
I've created a new apache directive called PythonSessionOption. This 
would be used to configure session handling in the apache config file. 
This data is accessed with a new request method, req.get_session_options().

Although we could use the PythonOption directive instead of creating a 
new one, I believe it's better to keep the session config data separate 
so we don't need to worry about collisions with current user code or 
configuration.

Typical Usage
-------------

In a test script mptest.py

def handler(req)
     opts = req.get_session_options()
     for k in sess_conf:
         req.write('%s: %s' % (k,opts[k])


In Session.FileSession:
     __init__(self,req,sid):
         opts = req.get_session_options()
         timeout = int(opts.get('timeout', DFT_TIMEOUT))


In an Apache config file:

<VirtualHost 192.168.1.12:80>
         ServerAdmin webmaster@localhost
         ServerName example.com
         DocumentRoot /var/www/

         PythonSessionOption session FileSession
         PythonSessionOption session_directory /var/lib/mod_python/sess 

         PythonSessionOption timeout 14400
         PythonSessionOption lock 1

         ...
</VirtualHost>

If there are no objections I'll commit the code. I have not refactored 
Sessions.py to use the new configuration scheme just yet.

Regards,
Jim

Mime
View raw message