From: Geoffrey T. <gta...@na...> - 2003-05-16 18:59:30
|
Hmmm. I haven't tried Webware from CVS recently, but it sounds like this behavior has changed since Webware 0.8. I'm pretty sure that in Webware 0.8, if you set IgnoreInvalidSession to 1 then when you call self.session(), if the session has expired then you get a fresh, empty session with no KeyError. If so, then this is a bug in CVS. Is there any chance you could try this with Webware 0.8? - Geoff > -----Original Message----- > From: Scott Lewis [mailto:sc...@ba...] > Sent: Friday, May 16, 2003 12:31 PM > To: web...@li... > Subject: [Webware-discuss] how to handle expired sessions? > > > hi, > > i'm new to webware and am having some problems with sessions. my needs > are simple and, i imagine, common. i'm probably overlooking something. > > when someone logs in, i set up some data and store it in the > session. if > the session expires, i want to notify the user and have them login > again. > > the docs seem to indicate that a lot of this is handled automatically. > but when the session expires, i get a KeyError. i can't figure out how > to detect this and generate a new, valid session. > > here are the session related settings in Application.config: > 'SessionStore': 'File', > 'SessionTimeout': 1, > 'MaxDynamicMemorySessions': 10000, > 'DynamicSessionTimeout': 1, > 'SessionPrefix': None, > 'IgnoreInvalidSession': 1, > > i also tried with SessionStore set to Memory and IgnoreInvalidSession > set to 0. same behavior. > > the error occurs on this line in writeContent(): > > sess = self.session() > > any ideas what i'm doing wrong? also, where can i do the check for an > expired session globally so i don't have to do it for each page? in > SitePage.awake(), with each page deriving from SitePage? > > thanks in advance for any help, > > -scott > > Webware version: from CVS a few days ago > > Traceback (most recent call last): > File "./WebKit/Application.py", line 429, in > dispatchRawRequest [edit] > self.runTransaction(trans) > File "./WebKit/Application.py", line 476, in runTransaction [edit] > self.runServlet(servlet, trans) > File "./WebKit/Application.py", line 501, in runServlet [edit] > servlet.runTransaction(trans) > File "./WebKit/Servlet.py", line 41, in runTransaction [edit] > self.respond(trans) > File "./WebKit/HTTPServlet.py", line 51, in respond [edit] > method(trans) > File "./WebKit/Page.py", line 60, in respondToGet [edit] > self._respond(transaction) > File "./WebKit/Page.py", line 102, in _respond [edit] > self.defaultAction() > File "./WebKit/Page.py", line 105, in defaultAction [edit] > self.writeHTML() > File "./WebKit/Page.py", line 211, in writeHTML [edit] > self.writeBody() > File "./WebKit/Page.py", line 287, in writeBody [edit] > self.writeBodyParts() > File "./WebKit/SidebarPage.py", line 47, in writeBodyParts [edit] > self.writeSidebar() > File "/home/csl/develop/python/address/SitePage.py", line 15, in > writeSidebar [edit] > sess = self.request().session() > File "./WebKit/HTTPRequest.py", line 225, in session [edit] > return self._transaction.session() > File "./WebKit/Transaction.py", line 67, in session [edit] > self._session = > self._application.createSessionForTransaction(self) > File "./WebKit/Application.py", line 307, in > createSessionForTransaction [edit] > session = self.session(sessId) > File "./WebKit/Application.py", line 275, in session [edit] > return self._sessions[sessionId] > File "./WebKit/SessionFileStore.py", line 50, in __getitem__ [edit] > raise KeyError, key > KeyError: 20030516091053-0371d5a44d500daea3657e0213a01c31 > > > > > > > ------------------------------------------------------- > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara > The only event dedicated to issues related to Linux > enterprise solutions > www.enterpriselinuxforum.com > > _______________________________________________ > Webware-discuss mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webware-discuss > |