Jason Stubbs
jstubbs at work-at.co.jp
Thu Sep 15 21:22:14 EDT 2005
Steve Bergman wrote: > 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 "BaseSession is a subclass of dict. Data can be stored and retrieved from the session by using it as a dictionary." -- docs It looks like what you want is: - sess.myVar2 = "I am a session variable." + sess["myVar2"] = "I am a session variable." -- Jason Stubbs
|