[repo] move cursor creation into the try/except, it may raises an InterfaceError if the connection is closed stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 19 Jan 2011 18:01:28 +0100
branchstable
changeset 6850 2b9e58174327
parent 6846 4dd1df437e15
child 6852 970d1aab42a1
[repo] move cursor creation into the try/except, it may raises an InterfaceError if the connection is closed
server/sources/native.py
--- a/server/sources/native.py	Wed Jan 19 12:42:50 2011 +0100
+++ b/server/sources/native.py	Wed Jan 19 18:01:28 2011 +0100
@@ -843,8 +843,8 @@
         if self._eid_creation_cnx is None:
             self._eid_creation_cnx = self.get_connection()
         cnx = self._eid_creation_cnx
-        cursor = cnx.cursor()
         try:
+            cursor = cnx.cursor()
             for sql in self.dbhelper.sqls_increment_sequence('entities_id_seq'):
                 cursor.execute(sql)
             eid = cursor.fetchone()[0]