[session] no way for queries from an InternalSession to be a dbapi query stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 09 Apr 2010 11:16:00 +0200
branchstable
changeset 5193 c9671feff5e2
parent 5192 e9dd56699097
child 5194 395f076512a1
child 5197 98dc05495e3e
[session] no way for queries from an InternalSession to be a dbapi query
server/session.py
server/test/unittest_session.py
--- a/server/session.py	Thu Apr 08 19:37:00 2010 +0200
+++ b/server/session.py	Fri Apr 09 11:16:00 2010 +0200
@@ -946,6 +946,7 @@
 class InternalSession(Session):
     """special session created internaly by the repository"""
     is_internal_session = True
+    running_dbapi_query = False
 
     def __init__(self, repo, cnxprops=None):
         super(InternalSession, self).__init__(InternalManager(), repo, cnxprops,
--- a/server/test/unittest_session.py	Thu Apr 08 19:37:00 2010 +0200
+++ b/server/test/unittest_session.py	Fri Apr 09 11:16:00 2010 +0200
@@ -7,6 +7,7 @@
 """
 from logilab.common.testlib import TestCase, unittest_main, mock_object
 
+from cubicweb.devtools.testlib import CubicWebTC
 from cubicweb.server.session import _make_description
 
 class Variable:
@@ -32,5 +33,10 @@
         self.assertEquals(_make_description((Function('max', 'A'), Variable('B')), {}, solution),
                           ['Int','CWUser'])
 
+class InternalSessionTC(CubicWebTC):
+    def test_dbapi_query(self):
+        session = self.repo.internal_session()
+        self.assertFalse(session.running_dbapi_query)
+
 if __name__ == '__main__':
     unittest_main()