[mod_python] Session Freezing using mod_python.Session

Kenneth Loafman kenneth at loafman.com
Wed Mar 14 17:56:47 EST 2007

Graham Dumpleton wrote:
> On 15/03/07, Kenneth Loafman <kenneth at loafman.com> wrote:
>> Hi,
>> The small snippet of code below freezes if there is an existing pysid
>> cookie (sample straight out of the manual).  If there is no pysid
>> cookie, then index() displays, but show() hangs.
> Yet you don't show us the code in show() which is the important bit.

It turns out that I did show the important bit, a blind request to get a 
new session.

> Normal practice is to always use:
>     if not hasattr(req,'session'):
>       req.session = Session.Session(req)
>     if req.session.is_new():
>       ...

This is exactly what I needed.  index() got the session, then called 
show() which tried to get a new session.  The docs seem to imply that 
Session(req) should look to see if a session exists, then use it. 
Obviously, that implication is not valid.

Thanks for all the help.  Its working now.


More information about the Mod_python mailing list