Re: Publisher, how to handle sessions

Graham Dumpleton <[email protected]>
Newsgroups gmane.comp.python.mod_python
Message-ID <[email protected]>
2009/3/3 Mihamina Rakotomandimby <[email protected]>:
> 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
is:

  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
mod_python?

Graham
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.