[mod_python] Sessions

David Badawi davidbadawi at yahoo.com
Thu Jun 2 20:46:56 EDT 2005


How about 
 
from mod_python import Session
 
def handler(req)
    session=Session.Session(req)
    session["condiment"] = "chutney"
    session.save()
    return apache.OK
 
sorry if someone already responded the like.
 
you could use FieldStorage(req,true) is you're getting values from forms.
 
David

Graham Dumpleton <grahamd at dscpl.com.au> wrote:
Nathan Olberding wrote ..
> In whatever function:
> 
> session = Session.Session(req)
> session["foo"] = "This is the foo string"
> session.save()
> 
> Then, in the function that generates the next page:
> 
> session = Session.Session(req)
> session.load()
> # Now, session["foo"] should equal "This is the foo string"

FYI.

Presuming you mean these two bits of code are in handlers for
different request URLs, I believe the "load()" is actually redundant
as it is done in the constructor of the Session object.

Graham
_______________________________________________
Mod_python mailing list
Mod_python at modpython.org
http://mailman.modpython.org/mailman/listinfo/mod_python
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050602/fbeba73c/attachment.html


More information about the Mod_python mailing list