[mod_python] Sessions

Colin Fox cfox at cfconsulting.ca
Sun Apr 4 21:13:43 EST 2004

Hi, all.

I'm trying to use sessions, and getting a wierd behaviour. Two 
behaviours, really. First, the site is very snappy and responsive until 
I add sessions, then suddenly every 10 pages or so the site will 
suddenly just not respond (and my current session use is pretty much 
just what I have as an example below).

Secondly, I can record values into the session in one part of my code, 
but when I check for them somewhere else, they're never there.

Are sessions global? There's a part in the docs about "Cookies generated 
by sessions..." are they talking about access to the session itself?

Here's a snippet of what I'm doing to test the session code:

     session = Session.Session(req)
     req.write("is_new(): %s" % session.is_new())

Any particular reason why that would lock up?

Lastly, when I call "session.save()" - That is only documented as 
writing session values to storage - is that supposed to be persistant 
storage, or memory? If I say "session['blah']=5", will that actually be 
stored in the session for alter retrieval, or do I have to call 
session.save() after every change, regardless of whether or not I want 
it to be server or client reset persistant?


ps. The "secret key" for a signed cookie - Can that be any value, or 
does that have to be an MD5 or something? The docs don't say. Can I just 
use "blah blah blah" as my secret?

More information about the Mod_python mailing list