[repo pyro] fix previous commit: should not import Pyro in remoterql module/base class, it may be missing stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 14 Sep 2012 17:42:24 +0200
branchstable
changeset 8545 eb7a171cec72
parent 8536 d764a2331a81
child 8546 3d2038d6f20d
[repo pyro] fix previous commit: should not import Pyro in remoterql module/base class, it may be missing
server/sources/pyrorql.py
server/sources/remoterql.py
--- a/server/sources/pyrorql.py	Mon Sep 03 12:26:20 2012 +0200
+++ b/server/sources/pyrorql.py	Fri Sep 14 17:42:24 2012 +0200
@@ -91,5 +91,9 @@
         except AttributeError:
             # inmemory connection
             pass
-        return super(PyroRQLSource, self).check_connection(cnx)
+        try:
+            return super(PyroRQLSource, self).check_connection(cnx)
+        except ConnectionClosedError:
+            # try to reconnect
+            return self.get_connection()
 
--- a/server/sources/remoterql.py	Mon Sep 03 12:26:20 2012 +0200
+++ b/server/sources/remoterql.py	Fri Sep 14 17:42:24 2012 +0200
@@ -30,8 +30,6 @@
 from rql.nodes import Constant
 from rql.utils import rqlvar_maker
 
-from Pyro.errors import ConnectionClosedError
-
 from cubicweb import dbapi, server
 from cubicweb import ValidationError, BadConnectionId, UnknownEid
 from cubicweb.schema import VIRTUAL_RTYPES
@@ -304,7 +302,7 @@
             try:
                 cnx.check()
                 return # ok
-            except (BadConnectionId, ConnectionClosedError):
+            except BadConnectionId:
                 pass
         # try to reconnect
         return self.get_connection()