[mod_python] Silly session help

Malcolm Lockyer maxp at orcon.net.nz
Mon Aug 23 15:06:40 EDT 2004


Hi All,

This is my first post, and I'd just like to say mod_python is awsome :). 
I'm happy to be getting away from the page-by-page style of PHP, and the 
horrible verbosity of java. Anyways - my session questions probably come 
from the fact I'm a relitive python and mod_python noobie. After much 
googling and looking through the mod_python documentation I still can't 
quite figure out how to use sessions.

When I try this example as noted in the mod_python documentation in 
section 4.8.1, it seems that the session keeps getting created :

from mod_python import apache, util, Session

def handler(req) :
    sess = Session.Session(req)
    if sess.is_new() :
        req.write("Hello this is a new session!")
    return apache.OK

Everytime I reload the page I get the "Hello this is a new session!" 
message. I tried checking what the timeout is with the .timeout() 
function, which returns 1800 (which seems to be a reasonable default). 
Anybody know what I'm missing?

At this point even a RTFM in the right direction would be extremely 
helpful...


More info:
Apache/2.0.50 (Gentoo/Linux) mod_python/3.1.3 Python/2.3.3 
mod_ssl/2.0.50 OpenSSL/0.9.7d DAV/2 PHP/5.0.0 Server at localhost Port 80
.htaccess:
SetHandler mod_python
PythonHandler Test
PythonDebug On


Help!


M


More information about the Mod_python mailing list