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 understanding]

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__() ?

Grisha

Reply via email to