Move setting session.mtime from dbapi to web session manager
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 05 Mar 2014 16:58:14 +0100
changeset 9573 99166335a8e0
parent 9572 73b2410bdadc
child 9574 2d4c4842bd04
Move setting session.mtime from dbapi to web session manager clean_session was broken since the switch away from dbapi on the web side, since session.mtime wasn't being set anywhere.
dbapi.py
web/views/sessions.py
--- a/dbapi.py	Thu Mar 13 17:01:13 2014 +0100
+++ b/dbapi.py	Wed Mar 05 16:58:14 2014 +0100
@@ -245,7 +245,6 @@
         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/views/sessions.py	Thu Mar 13 17:01:13 2014 +0100
+++ b/web/views/sessions.py	Wed Mar 05 16:58:14 2014 +0100
@@ -21,6 +21,8 @@
 
 __docformat__ = "restructuredtext en"
 
+from time import time
+
 from cubicweb import (RepositoryError, Unauthorized, AuthenticationError,
                       BadConnectionId)
 from cubicweb.web import InvalidSession, Redirect
@@ -73,6 +75,7 @@
         """
         session, login = self.authmanager.authenticate(req)
         self._sessions[session.sessionid] = session
+        session.mtime = time()
         return session
 
     def postlogin(self, req, session):