Nick wrote:
How about an explicit "None" value to completely disable it? If you don't want users on your site using it.

Do you mean to disable sessions, or just the session configuration?

Jim


Nick

Jim Gallacher wrote:

So, any further thoughts / comments / objections to PythonSessionOption,
 or shall I just check in the code?

Regards
Jim


Jim Gallacher wrote:

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





Reply via email to