cubicweb/test/unittest_rqlrewrite.py
changeset 12882 3ddd03309315
parent 12567 26744ad37953
equal deleted inserted replaced
12881:38fcf5707295 12882:3ddd03309315
    56 def _prepare_rewriter(rewriter_cls, kwargs):
    56 def _prepare_rewriter(rewriter_cls, kwargs):
    57     class FakeVReg:
    57     class FakeVReg:
    58         schema = schema
    58         schema = schema
    59 
    59 
    60         @staticmethod
    60         @staticmethod
    61         def solutions(sqlcursor, rqlst, kwargs):
    61         def compute_var_types(sqlcursor, rqlst, kwargs):
    62             rqlhelper.compute_solutions(rqlst, {'eid': eid_func_map}, kwargs=kwargs)
    62             rqlhelper.compute_solutions(rqlst, {'eid': eid_func_map}, kwargs=kwargs)
    63 
    63 
    64         class rqlhelper:
    64         class rqlhelper:
    65             @staticmethod
    65             @staticmethod
    66             def annotate(rqlst):
    66             def annotate(rqlst):
   600     def process(self, rql, args=None):
   600     def process(self, rql, args=None):
   601         if args is None:
   601         if args is None:
   602             args = {}
   602             args = {}
   603         union = parse(rql)  # self.vreg.parse(rql, annotate=True)
   603         union = parse(rql)  # self.vreg.parse(rql, annotate=True)
   604         with self.admin_access.repo_cnx() as cnx:
   604         with self.admin_access.repo_cnx() as cnx:
   605             self.vreg.solutions(cnx, union, args)
   605             self.vreg.compute_var_types(cnx, union, args)
   606             self.vreg.rqlhelper.annotate(union)
   606             self.vreg.rqlhelper.annotate(union)
   607             plan = self.repo.querier.plan_factory(union, args, cnx)
   607             plan = self.repo.querier.plan_factory(union, args, cnx)
   608             plan.preprocess(union)
   608             plan.preprocess(union)
   609             return union
   609             return union
   610 
   610