# HG changeset patch # User Sylvain Thénault # Date 1270804560 -7200 # Node ID c9671feff5e247bf0d02f7c610ec35204246b4dc # Parent e9dd56699097cf32f36f6ecf77d7a13b2c48c844 [session] no way for queries from an InternalSession to be a dbapi query diff -r e9dd56699097 -r c9671feff5e2 server/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, diff -r e9dd56699097 -r c9671feff5e2 server/test/unittest_session.py --- 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()