Hi Jim,
Why not have a single 'PythonSessionCreate' option which contains the
line of code that should be evaled to create the session ?
Example :
PythonSessionCreate
"Session.FileSession(session_directory='/var/lib/mod_python/sess',timeout=14400,lock=1)"
The cost of eval could be brought down by precompiling the option
string to a code object and running the code object in precompiled
form.
This seems a bit more flexible to me and won't force you to refactor
the Session.py code.
Regards,
Nicolas
2005/6/12, Jim Gallacher <[EMAIL PROTECTED]>:
> 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 [EMAIL PROTECTED]
> 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
>