[mod_python] Using session management?

Steve Bergman steve at rueb.com
Thu Sep 15 20:34:49 EDT 2005


In my previous message I cut and pasted the wrong snippet.  This is what 
I meant:

from mod_python import Session

def main(req):
       sess = Session.Session(req)
       if sess.is_new():
       s = '<html>This is a new session.</html>'
       sess.myVar2 = "I am a session variable."
       sess.save()
       return s
   else:
       sess.load()
       s='<html>This is an old session.  myVar2 = ' + sess.myVar2 + 
'</html>'
       sess.save()
       return s


Thanks,
Steve


More information about the Mod_python mailing list