[session pool] dont check closed session when calling set_pool from super_session
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 11 Aug 2009 17:03:27 +0200
changeset 2764 55579275a091
parent 2763 39b42e158249
child 2765 5e2525d7b1b1
[session pool] dont check closed session when calling set_pool from super_session
server/session.py
--- a/server/session.py	Tue Aug 11 17:02:50 2009 +0200
+++ b/server/session.py	Tue Aug 11 17:03:27 2009 +0200
@@ -208,9 +208,9 @@
         """connections pool, set according to transaction mode for each query"""
         return getattr(self._threaddata, 'pool', None)
 
-    def set_pool(self):
+    def set_pool(self, checkclosed=True):
         """the session need a pool to execute some queries"""
-        if self._closed:
+        if checkclosed and self._closed:
             raise Exception('try to set pool on a closed session')
         if self.pool is None:
             # get pool first to avoid race-condition
@@ -335,7 +335,7 @@
                 csession = ChildSession(self)
             self._threaddata.childsession = csession
         # need shared pool set
-        self.set_pool()
+        self.set_pool(checkclosed=False)
         return csession
 
     def unsafe_execute(self, rql, kwargs=None, eid_key=None, build_descr=True,