server/session.py
branchstable
changeset 2306 95da5d9f0870
parent 2200 25bb65dc4559
child 2319 654decb099e3
--- a/server/session.py	Tue Jul 07 11:42:24 2009 +0200
+++ b/server/session.py	Tue Jul 07 12:24:40 2009 +0200
@@ -88,9 +88,7 @@
         """return a sql cursor on the system database"""
         if not sql.split(None, 1)[0].upper() == 'SELECT':
             self.mode = 'write'
-        cursor = self.pool['system']
-        self.pool.source('system').doexec(cursor, sql, args)
-        return cursor
+        return self.pool.source('system').doexec(self, sql, args)
 
     def set_language(self, language):
         """i18n configuration for translation"""
@@ -137,12 +135,12 @@
             raise Exception('try to set pool on a closed session')
         if self.pool is None:
             # get pool first to avoid race-condition
-            self._threaddata.pool = self.repo._get_pool()
+            self._threaddata.pool = pool = self.repo._get_pool()
             try:
-                self._threaddata.pool.pool_set()
+                pool.pool_set()
             except:
                 self._threaddata.pool = None
-                self.repo._free_pool(self.pool)
+                self.repo._free_pool(pool)
                 raise
             self._threads_in_transaction.add(threading.currentThread())
         return self._threaddata.pool