server/session.py
branchstable
changeset 5108 8495d580a580
parent 5074 bc481dab93d4
child 5130 929984f017e6
--- a/server/session.py	Wed Mar 31 12:51:35 2010 +0200
+++ b/server/session.py	Wed Mar 31 12:53:24 2010 +0200
@@ -278,8 +278,13 @@
         """return a sql cursor on the system database"""
         if not sql.split(None, 1)[0].upper() == 'SELECT':
             self.mode = 'write'
-        return self.pool.source('system').doexec(self, sql, args,
-                                                 rollback=rollback_on_failure)
+        source = self.pool.source('system')
+        try:
+            return source.doexec(self, sql, args, rollback=rollback_on_failure)
+        except (source.OperationalError, source.InterfaceError):
+            source.warning("trying to reconnect")
+            self.pool.reconnect(self)
+            return source.doexec(self, sql, args, rollback=rollback_on_failure)
 
     def set_language(self, language):
         """i18n configuration for translation"""