[test] fix test broken by 7815:2a164a9cf81c stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 21 Sep 2011 18:35:39 +0200
branchstable
changeset 7817 cb6174065c39
parent 7815 2a164a9cf81c
child 7818 be4a3e97090d
[test] fix test broken by 7815:2a164a9cf81c
web/test/unittest_session.py
web/views/sessions.py
--- 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