[mod_python] Publisher Weirdness

Graham Dumpleton grahamd at dscpl.com.au
Mon Feb 27 04:38:05 EST 2006


On 27/02/2006, at 7:36 PM, marinus van aswegen wrote:

> def validate_session(req):
>     """
>     this function must be called prior to all function to
>     ensure that the user is autenticated
>     """
>
>     # get the session for this request
>     session = Session.Session(req, secret = config.cookie_passwd)
>      .....

> def test(req):
>
>     validate_session(req)
>
>     session = Session.Session(req, secret = config.cookie_passwd)

Here is your first problem. The validate_session() function has already
created a session object. Creating the second here for the same request
will cause a deadlock.

There are various other things which could be done better, but will just
point out this obvious thing for now.

Graham


More information about the Mod_python mailing list