[web session] fix bad cleanup of session without a connection set. Closes #1772125 stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 30 Jun 2011 16:26:25 +0200
branchstable
changeset 7589 d3459fe041f0
parent 7587 c7c0f53062f5
child 7592 c84436b79793
[web session] fix bad cleanup of session without a connection set. Closes #1772125
dbapi.py
web/application.py
--- a/dbapi.py	Thu Jun 30 08:27:56 2011 +0200
+++ b/dbapi.py	Thu Jun 30 16:26:25 2011 +0200
@@ -241,6 +241,7 @@
         self.cnx = cnx
         self.data = {}
         self.login = login
+        self.mtime = time()
         # dbapi session identifier is the same as the first connection
         # identifier, but may later differ in case of auto-reconnection as done
         # by the web authentication manager (in cw.web.views.authentication)
--- a/web/application.py	Thu Jun 30 08:27:56 2011 +0200
+++ b/web/application.py	Thu Jun 30 16:26:25 2011 +0200
@@ -71,6 +71,8 @@
             total += 1
             try:
                 last_usage_time = session.cnx.check()
+            except AttributeError:
+                last_usage_time = session.mtime
             except BadConnectionId:
                 self.close_session(session)
                 closed += 1
@@ -228,7 +230,9 @@
                             self.session_manager.close_session(session)
 
     def get_session(self, req, sessionid):
-        return self.session_manager.get_session(req, sessionid)
+        session = self.session_manager.get_session(req, sessionid)
+        session.mtime = time()
+        return session
 
     def open_session(self, req, allow_no_cnx=True):
         session = self.session_manager.open_session(req, allow_no_cnx=allow_no_cnx)