--- a/web/test/unittest_session.py Wed Sep 21 17:38:00 2011 +0200
+++ b/web/test/unittest_session.py Wed Sep 21 18:35:39 2011 +0200
@@ -2,7 +2,7 @@
"""unit tests for cubicweb.web.application
:organization: Logilab
-:copyright: 2001-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
+:copyright: 2001-2011 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses
"""
--- a/web/views/sessions.py Wed Sep 21 17:38:00 2011 +0200
+++ b/web/views/sessions.py Wed Sep 21 18:35:39 2011 +0200
@@ -21,7 +21,8 @@
__docformat__ = "restructuredtext en"
-from cubicweb import RepositoryError, Unauthorized, AuthenticationError
+from cubicweb import (RepositoryError, Unauthorized, AuthenticationError,
+ BadConnectionId)
from cubicweb.web import InvalidSession, Redirect
from cubicweb.web.application import AbstractSessionManager
from cubicweb.dbapi import DBAPISession
@@ -130,5 +131,8 @@
self.info('closing http session %s' % session.sessionid)
del self._sessions[session.sessionid]
if session.cnx:
- session.cnx.close()
+ try:
+ session.cnx.close()
+ except BadConnectionId: # expired on the repository side
+ pass
session.cnx = None