[mod_python] mod_python session trouble

Wouter van Marle wouter at squirrel-systems.com
Tue May 10 10:46:44 EDT 2005


Thank you all for the advices, I'm going to try it tomorrow. At least it
gives me something to try out, and a bit better understanding of the
process. Unfortunately the documentation is pretty sparse there.
Some more comments below on why reading a separate cookie:


> call sess.save() before the end of your request as saving is not 
> automatic. The other way you may get a new session for each request is 
> if you start writing the response before the session is created. The 
> session must be able to set a cookie in the response sent to the 
> browser, and this is not possible if you've already started to send your 
> reply.


So I should call sess.save() before doing any psp run() or req.write(),
right? That is now not the case (I do the save at the very end of the
routine - after sending the page).


> I'm a little unclear why you are reading and writing the cookies, 
> assuming you mean the session cookie. 


I think of using a separate cookie for persistent information (currently
set to 90 day expiry) against session which includes login info and is
to keep the user logged with a timeout of say 30 minutes. At the
beginning of the session (new session) I want to read that persistent
information to provide a somewhat personalised site. Currently that is
only the language and the username if known, though in future that may
be more.

Wouter.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20050510/c7427e60/attachment.html


More information about the Mod_python mailing list