[server.querier] remove useless indirection Querier.rqlannotator
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Wed, 13 Mar 2019 11:02:39 +0100
changeset 12887 11953d585a55
parent 12886 fa565be41647
child 12888 24a20d2b8c84
[server.querier] remove useless indirection Querier.rqlannotator
cubicweb/server/querier.py
cubicweb/server/sources/native.py
--- a/cubicweb/server/querier.py	Wed Mar 13 10:40:05 2019 +0100
+++ b/cubicweb/server/querier.py	Wed Mar 13 11:02:39 2019 +0100
@@ -211,7 +211,7 @@
             noinvariant = ()
         if cached is None:
             self.cnx.vreg.rqlhelper.simplify(union)
-            self.querier.rqlannotator.annotate(union)
+            RQLAnnotator(self.querier.schema).annotate(union)
             set_qdata(self.querier.schema.rschema, union, noinvariant)
         if union.has_text_query:
             self.cache_key = None
@@ -475,8 +475,6 @@
         self.clear_caches()
         # rql planner
         self._planner = SSPlanner(schema, self._repo.vreg.rqlhelper)
-        # sql generation annotator
-        self.rqlannotator = RQLAnnotator(schema)
 
     def clear_caches(self, eids=None, etypes=None):
         if eids is None:
@@ -562,7 +560,6 @@
         }
 
         start = time.time()
-
         # execute the plan
         try:
             results = plan.execute()
--- a/cubicweb/server/sources/native.py	Wed Mar 13 10:40:05 2019 +0100
+++ b/cubicweb/server/sources/native.py	Wed Mar 13 11:02:39 2019 +0100
@@ -48,7 +48,7 @@
 from cubicweb.server import schema2sql as y2sql
 from cubicweb.server.utils import crypt_password, verify_and_update
 from cubicweb.server.sqlutils import SQL_PREFIX, SQLAdapterMixIn
-from cubicweb.server.rqlannotation import set_qdata
+from cubicweb.server.rqlannotation import RQLAnnotator, set_qdata
 from cubicweb.server.hook import CleanupDeletedEidsCacheOp
 from cubicweb.server.edition import EditedEntity
 from cubicweb.server.sources import AbstractSource, dbg_st_search, dbg_results, rql2sql
@@ -472,7 +472,7 @@
         rqlst = self.repo.vreg.rqlhelper.parse(rql)
         rqlst.restricted_vars = ()
         rqlst.children[0].solutions = sols
-        self.repo.querier.rqlannotator.annotate(rqlst)
+        RQLAnnotator(self.repo.querier.schema).annotate(rqlst)
         set_qdata(self.schema.rschema, rqlst, ())
         return rqlst