[multi-sources-removal] Drop cnxset_freed from source interface
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 27 Jun 2013 09:18:39 +0200
changeset 9465 86d4b41ae339
parent 9464 6f4f710aef83
child 9466 c3a5f4507f12
[multi-sources-removal] Drop cnxset_freed from source interface Though a hack is still needed when using sqlite Related to #2919300
server/pool.py
server/sources/__init__.py
server/sources/native.py
--- a/server/pool.py	Wed Jan 22 15:35:13 2014 +0100
+++ b/server/pool.py	Thu Jun 27 09:18:39 2013 +0200
@@ -77,7 +77,7 @@
 
     def cnxset_freed(self):
         """connections set is being freed from a session"""
-        self._source.cnxset_freed(self.cnx)
+        pass # do nothing by default
 
     def reconnect(self):
         """reopen a connection for this source or all sources if none specified
--- a/server/sources/__init__.py	Wed Jan 22 15:35:13 2014 +0100
+++ b/server/sources/__init__.py	Thu Jun 27 09:18:39 2013 +0200
@@ -249,14 +249,6 @@
             cnxset.cnx = self.get_connection()
             cnxset.cu = cnxset.cnx.cursor()
 
-    def cnxset_freed(self, cnx):
-        """the connections set holding the given connection is being reseted
-        from its current attached session.
-
-        do nothing by default
-        """
-        pass
-
     # cache handling ###########################################################
 
     def reset_caches(self):
--- a/server/sources/native.py	Wed Jan 22 15:35:13 2014 +0100
+++ b/server/sources/native.py	Thu Jun 27 09:18:39 2013 +0200
@@ -291,12 +291,13 @@
         # running unittest_multisources with the wrapping below
         if self.dbdriver == 'sqlite' and \
                not getattr(repo.config, 'no_sqlite_wrap', False):
+            from cubicweb.server.pool import ConnectionsSet
             self.dbhelper.dbname = abspath(self.dbhelper.dbname)
             self.get_connection = lambda: SqliteCnxLoggingWrapper(self)
             self.check_connection = lambda cnx: cnx
-            def cnxset_freed(cnx):
-                cnx.close()
-            self.cnxset_freed = cnxset_freed
+            def cnxset_freed(self):
+                self.cnx.close()
+            ConnectionsSet.cnxset_freed = cnxset_freed
         if self.dbdriver == 'sqlite':
             self._create_eid = None
             self.create_eid = self._create_eid_sqlite