[mod_python] Publisher, how to handle sessions

Graham Dumpleton graham.dumpleton at gmail.com
Mon Mar 2 23:39:33 EST 2009

2009/3/3 Mihamina Rakotomandimby <mihamina at lab.vectoris.fr>:
> Graham Dumpleton wrote:
>> You will get deadlock doing that.
> Ok, that's (one of) the point where I really needed help :-)
>> By assigning it to req.session,
> Is it about assigning once (and never more later)? No more instanciation,
> then.

Only one session object should be created for a request. The
convention you should follow everywhere if mixing publisher and PSP,
or if calling common routines which also want to fiddle session stuff

  if not hasattr(req, 'session'):
    req.session = Session.Session(req)

and then use req.session. This is what PSP does, presuming you aren't
using obsolete mod_python version. If you are using old mod_python
version, ensure you upgrade to mod_python 3.3.1.

BTW, why do you only want to use mod_python when there are lots of
options available for this today, many arguably a lot better than


More information about the Mod_python mailing list