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 

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:
         opts = req.get_session_options()
         timeout = int(opts.get('timeout', DFT_TIMEOUT))

In an Apache config file:

         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


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


View raw message