[mod_python] Publisher, how to handle sessions

Graham Dumpleton graham.dumpleton at gmail.com
Mon Mar 2 16:38:52 EST 2009


You will get deadlock doing that.

In the publisher function assign the session to:

  req.session

and not a local variable.

By assigning it to req.session, PSP code will see it and use it rather
than trying to create a new one and causing a deadlock.

Graham

2009/3/3 Mihamina Rakotomandimby <mihamina at lab.vectoris.fr>:
> Hi
> My .htaccess:
> http://lab.vectoris.fr/projects/vectoris/browser/EncycloPyDia/trunk/.htaccess
> My Python file:
> http://lab.vectoris.fr/projects/vectoris/browser/EncycloPyDia/trunk/index.py
>
> Two templates:
> http://lab.vectoris.fr/projects/vectoris/browser/EncycloPyDia/trunk/index.html
> http://lab.vectoris.fr/projects/vectoris/browser/EncycloPyDia/trunk/index_2.html
>
> Please, these files are crappy, just for testing purpose, disable your
> --pedant flag ;-).
>
> I see the session mecanism working with those files:
> If a session['login'] is set, then it's OK.
>
> When using PSP handler (not the Publisher) just using a variable named
> "session" is enough to handle sessions. Here, I had to instanciate one in
> each function.
> On the other hand, I saw forms are very easily handled, they are
> automagically set to variables.
>
> Is there a way, using the Publisher, to easily handle sessions?
>
> My real goal is to use templating-like code, just like this one given in
> example, _and_ easily handle forms and session. I do want to use mod_python
> (just mod_python, nothig more): the publisher might not be the best
> approach?
>
> Thank you!
>
> --
> Chef de projet chez Vectoris
> http://www.google.com/search?q=mihamina+rakotomandimby
> Telephone: +261 33 11 207 36
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python
>


More information about the Mod_python mailing list