[server/querier] remove useless indirection QuerierHelper._annotate
authorNicolas Chauvat <nicolas.chauvat@logilab.fr>
Tue, 12 Mar 2019 23:45:15 +0100
changeset 12496 ad995a9905f9
parent 12495 23081860ea60
child 12498 1ec5b23b92e7
[server/querier] remove useless indirection QuerierHelper._annotate
cubicweb/server/querier.py
cubicweb/server/test/unittest_security.py
cubicweb/test/unittest_rqlrewrite.py
--- a/cubicweb/server/querier.py	Tue Mar 12 23:04:57 2019 +0100
+++ b/cubicweb/server/querier.py	Tue Mar 12 23:45:15 2019 +0100
@@ -480,10 +480,8 @@
     def set_schema(self, schema):
         self.schema = schema
         self.clear_caches()
-        rqlhelper = self._repo.vreg.rqlhelper
-        self._annotate = rqlhelper.annotate
         # rql planner
-        self._planner = SSPlanner(schema, rqlhelper)
+        self._planner = SSPlanner(schema, self._repo.vreg.rqlhelper)
         # sql generation annotator
         self.sqlgen_annotate = SQLGenAnnotator(schema).annotate
 
@@ -549,7 +547,7 @@
             # Rewrite computed relations
             rewriter = RQLRelationRewriter(cnx)
             rewriter.rewrite(rqlst, args)
-            self._annotate(rqlst)
+            self._repo.vreg.rqlhelper.annotate(rqlst)
             if args:
                 # different SQL generated when some argument is None or not (IS
                 # NULL). This should be considered when computing sql cache key
--- a/cubicweb/server/test/unittest_security.py	Tue Mar 12 23:04:57 2019 +0100
+++ b/cubicweb/server/test/unittest_security.py	Tue Mar 12 23:45:15 2019 +0100
@@ -523,9 +523,8 @@
             with self.new_access(u'iaminusersgrouponly').repo_cnx() as cnx:
                 rqlst = self.repo.vreg.rqlhelper.parse('Any X WHERE X is_instance_of Societe')
                 self.repo.vreg.solutions(cnx, rqlst, {})
-                querier = cnx.repo.querier
-                querier._annotate(rqlst)
-                plan = querier.plan_factory(rqlst, {}, cnx)
+                self.repo.vreg.rqlhelper.annotate(rqlst)
+                plan = cnx.repo.querier.plan_factory(rqlst, {}, cnx)
                 plan.preprocess(rqlst)
                 self.assertEqual(
                     rqlst.as_string(),
--- a/cubicweb/test/unittest_rqlrewrite.py	Tue Mar 12 23:04:57 2019 +0100
+++ b/cubicweb/test/unittest_rqlrewrite.py	Tue Mar 12 23:45:15 2019 +0100
@@ -602,12 +602,11 @@
     def process(self, rql, args=None):
         if args is None:
             args = {}
-        querier = self.repo.querier
         union = parse(rql)  # self.vreg.parse(rql, annotate=True)
         with self.admin_access.repo_cnx() as cnx:
             self.vreg.solutions(cnx, union, args)
-            querier._annotate(union)
-            plan = querier.plan_factory(union, args, cnx)
+            self.vreg.rqlhelper.annotate(union)
+            plan = self.repo.querier.plan_factory(union, args, cnx)
             plan.preprocess(union)
             return union