web/application.py
branchstable
changeset 7589 d3459fe041f0
parent 7428 5338d895b891
child 7815 2a164a9cf81c
equal deleted inserted replaced
7587:c7c0f53062f5 7589:d3459fe041f0
    69         closed, total = 0, 0
    69         closed, total = 0, 0
    70         for session in self.current_sessions():
    70         for session in self.current_sessions():
    71             total += 1
    71             total += 1
    72             try:
    72             try:
    73                 last_usage_time = session.cnx.check()
    73                 last_usage_time = session.cnx.check()
       
    74             except AttributeError:
       
    75                 last_usage_time = session.mtime
    74             except BadConnectionId:
    76             except BadConnectionId:
    75                 self.close_session(session)
    77                 self.close_session(session)
    76                 closed += 1
    78                 closed += 1
    77             else:
    79             else:
    78                 no_use_time = (time() - last_usage_time)
    80                 no_use_time = (time() - last_usage_time)
   226                             # session should be replaced by new session created
   228                             # session should be replaced by new session created
   227                             # in open_session
   229                             # in open_session
   228                             self.session_manager.close_session(session)
   230                             self.session_manager.close_session(session)
   229 
   231 
   230     def get_session(self, req, sessionid):
   232     def get_session(self, req, sessionid):
   231         return self.session_manager.get_session(req, sessionid)
   233         session = self.session_manager.get_session(req, sessionid)
       
   234         session.mtime = time()
       
   235         return session
   232 
   236 
   233     def open_session(self, req, allow_no_cnx=True):
   237     def open_session(self, req, allow_no_cnx=True):
   234         session = self.session_manager.open_session(req, allow_no_cnx=allow_no_cnx)
   238         session = self.session_manager.open_session(req, allow_no_cnx=allow_no_cnx)
   235         cookie = req.get_cookie()
   239         cookie = req.get_cookie()
   236         sessioncookie = self.session_cookie(req)
   240         sessioncookie = self.session_cookie(req)