Jim Gallacher
jpg at jgassociates.ca
Fri Oct 13 11:16:01 EDT 2006
Alex Greif wrote: > Hi, > > I have the problem that getting the session instance in a handler more > than once makes the server hang on the second access to the session. > the problem does ot occure on windows XP but on suse Linux with 3.2.10 > > Here is my scenario: > > def view_ticket_detail(req, ticketId): > def __access__(req, user): > ... > # webutil.authorize will get the session > return webutil.authorize(req=req, login=user, neededRole=neededRole) > > req.content_type = "text/html" > ... > # now I need the session again > session = Session.MemorySession(req) ###### <-- here the server hangs > > any ideas? Yep. You've deadlock the session. You can't have more than one session instance in the same request. Put your session in the req object within your webutil.authroize() code, and when you need it later retrieve it from there. webutil.py ========== def authorize(req): req.session = Session.MemorySession(req) ... And in when you need it later: def view_ticket_detail(req, ticketId): def __access__(req, user): ... # webutil.authorize will get the session return webutil.authorize(req=req, login=user, neededRole=neededRole) req.content_type = "text/html" ... # now I need the session again session = req.session Jim
|