quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory (Grisha) Trubetskoy" <gri...@apache.org>
Subject Re: get_session(), req.session, req.form and MODPYTHON-38
Date Tue, 14 Mar 2006 02:25:47 GMT

On Mon, 13 Mar 2006, Jim Gallacher wrote:

> The idea of something like req.get_session() is to give users an obvious way 
> to grab a session object without the deadlock concerns. How many times have 
> we seen this kind of problem-code on the mailing list?
> def index(req):
>    sess = Session.Session(req)
>    do_stuff(req)
>    ...
> def do_stuff(req):
>    sess = Session.Session(req)
>    ... do other stuff.
> Having the session constructor check for the existence of req.session is of 
> no use here. We need a way to make sure only *one* session instance is 
> created per request. (Bonus marks for making it work with internal redirect).

[sorry, i only read the beginning of the message, so i might be not fully 

Session.Session is not a constructor, just a function. But also, if it 
were, I think this can be solved with the new object's __new__() ?


View raw message