[web session] ProgrammingError may be raised, we should catch it (closes #1980076)
--- a/dbapi.py Tue Oct 04 13:58:57 2011 +0200
+++ b/dbapi.py Tue Oct 04 13:59:12 2011 +0200
@@ -254,6 +254,8 @@
def anonymous_session(self):
return not self.cnx or self.cnx.anonymous_connection
+ def __repr__(self):
+ return '<DBAPISession %r>' % self.sessionid
class DBAPIRequest(RequestSessionBase):
--- a/web/views/sessions.py Tue Oct 04 13:58:57 2011 +0200
+++ b/web/views/sessions.py Tue Oct 04 13:59:12 2011 +0200
@@ -25,7 +25,7 @@
BadConnectionId)
from cubicweb.web import InvalidSession, Redirect
from cubicweb.web.application import AbstractSessionManager
-from cubicweb.dbapi import DBAPISession
+from cubicweb.dbapi import ProgrammingError, DBAPISession
class InMemoryRepositorySessionManager(AbstractSessionManager):
@@ -133,6 +133,6 @@
if session.cnx:
try:
session.cnx.close()
- except BadConnectionId: # expired on the repository side
+ except (ProgrammingError, BadConnectionId): # expired on the repository side
pass
session.cnx = None