# HG changeset patch # User Nicolas Chauvat # Date 1552432548 -3600 # Node ID 3ddd03309315c9e9dd7cf4f48d73acc3fff1605b # Parent 38fcf5707295684744b44513421b463783c8070e [cwvreg] rename CWRegistryStore.solutions to compute_var_types solutions() seems an obscure name to me. Since this method computes the types of the variables of the RQL query string, let us rename it to compute_var_types. diff -r 38fcf5707295 -r 3ddd03309315 cubicweb/cwvreg.py --- a/cubicweb/cwvreg.py Sun Feb 02 22:15:38 2020 +0100 +++ b/cubicweb/cwvreg.py Wed Mar 13 00:15:48 2019 +0100 @@ -550,7 +550,7 @@ return RQLHelper(self.schema, special_relations={'eid': 'uid', 'has_text': 'fti'}) - def solutions(self, req, rqlst, args): + def compute_var_types(self, req, rqlst, args): def type_from_eid(eid, req=req): return req.entity_type(eid) return self.rqlhelper.compute_solutions(rqlst, {'eid': type_from_eid}, args) @@ -558,7 +558,7 @@ def parse(self, req, rql, args=None): rqlst = self.rqlhelper.parse(rql) try: - self.solutions(req, rqlst, args) + self.compute_var_types(req, rqlst, args) except UnknownEid: for select in rqlst.children: select.solutions = [] diff -r 38fcf5707295 -r 3ddd03309315 cubicweb/devtools/repotest.py --- a/cubicweb/devtools/repotest.py Sun Feb 02 22:15:38 2020 +0100 +++ b/cubicweb/devtools/repotest.py Wed Mar 13 00:15:48 2019 +0100 @@ -209,7 +209,7 @@ def _prepare_plan(self, cnx, rql, kwargs=None): rqlst = self.repo.vreg.rqlhelper.parse(rql, annotate=True) - self.repo.vreg.solutions(cnx, rqlst, kwargs) + self.repo.vreg.compute_var_types(cnx, rqlst, kwargs) if rqlst.TYPE == 'select': self.repo.vreg.rqlhelper.annotate(rqlst) for select in rqlst.children: diff -r 38fcf5707295 -r 3ddd03309315 cubicweb/entity.py --- a/cubicweb/entity.py Sun Feb 02 22:15:38 2020 +0100 +++ b/cubicweb/entity.py Wed Mar 13 00:15:48 2019 +0100 @@ -1118,7 +1118,7 @@ etypecls.fetch_rqlst(self._cw.user, select, searchedvar, ordermethod=ordermethod) # from now on, we need variable type resolving - self._cw.vreg.solutions(self._cw, select, args) + self._cw.vreg.compute_var_types(self._cw, select, args) # insert RQL expressions for schema constraints into the rql syntax tree if vocabconstraints: cstrcls = (RQLVocabularyConstraint, RQLConstraint) diff -r 38fcf5707295 -r 3ddd03309315 cubicweb/rqlrewrite.py --- a/cubicweb/rqlrewrite.py Sun Feb 02 22:15:38 2020 +0100 +++ b/cubicweb/rqlrewrite.py Wed Mar 13 00:15:48 2019 +0100 @@ -245,7 +245,7 @@ vreg = session.vreg self.schema = vreg.schema self.annotate = vreg.rqlhelper.annotate - self._compute_solutions = vreg.solutions + self._compute_solutions = vreg.compute_var_types def compute_solutions(self): self.annotate(self.select) diff -r 38fcf5707295 -r 3ddd03309315 cubicweb/server/querier.py --- a/cubicweb/server/querier.py Sun Feb 02 22:15:38 2020 +0100 +++ b/cubicweb/server/querier.py Wed Mar 13 00:15:48 2019 +0100 @@ -634,7 +634,7 @@ # some cache usage stats self.cache_hit, self.cache_miss = 0, 0 # rql parsing / analysing helper - self.solutions = repo.vreg.solutions + self.compute_var_types = repo.vreg.compute_var_types rqlhelper = repo.vreg.rqlhelper # set backend on the rql helper, will be used for function checking rqlhelper.backend = repo.config.system_source_config['db-driver'] @@ -677,7 +677,7 @@ # which are eids. Notice that if you may not need `eidkeys`, we # have to compute solutions anyway (kept as annotation on the # tree) - eidkeys = self.solutions(cnx, rqlst, args) + eidkeys = self.compute_var_types(cnx, rqlst, args) if args and rql not in self._ck_cache: self._ck_cache[rql] = eidkeys if eidkeys: diff -r 38fcf5707295 -r 3ddd03309315 cubicweb/server/test/unittest_server_security.py --- a/cubicweb/server/test/unittest_server_security.py Sun Feb 02 22:15:38 2020 +0100 +++ b/cubicweb/server/test/unittest_server_security.py Wed Mar 13 00:15:48 2019 +0100 @@ -44,7 +44,7 @@ nom = self.repo.schema['Personne'].rdef('nom') with self.temporary_permissions((nom, {'read': ('users', 'managers')})): with self.admin_access.repo_cnx() as cnx: - self.repo.vreg.solutions(cnx, rqlst, None) + self.repo.vreg.compute_var_types(cnx, rqlst, None) check_relations_read_access(cnx, rqlst, {}) with self.new_access(u'anon').repo_cnx() as cnx: self.assertRaises(Unauthorized, @@ -57,7 +57,7 @@ rqlst = self.repo.vreg.rqlhelper.parse(rql).children[0] with self.temporary_permissions(Personne={'read': ('users', 'managers')}): with self.admin_access.repo_cnx() as cnx: - self.repo.vreg.solutions(cnx, rqlst, None) + self.repo.vreg.compute_var_types(cnx, rqlst, None) solution = rqlst.solutions[0] localchecks = get_local_checks(cnx, rqlst, solution) self.assertEqual({}, localchecks) @@ -520,7 +520,7 @@ ERQLExpression('X owned_by U'))}): 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, {}) + self.repo.vreg.compute_var_types(cnx, rqlst, {}) self.repo.vreg.rqlhelper.annotate(rqlst) plan = cnx.repo.querier.plan_factory(rqlst, {}, cnx) plan.preprocess(rqlst) diff -r 38fcf5707295 -r 3ddd03309315 cubicweb/test/unittest_rqlrewrite.py --- a/cubicweb/test/unittest_rqlrewrite.py Sun Feb 02 22:15:38 2020 +0100 +++ b/cubicweb/test/unittest_rqlrewrite.py Wed Mar 13 00:15:48 2019 +0100 @@ -58,7 +58,7 @@ schema = schema @staticmethod - def solutions(sqlcursor, rqlst, kwargs): + def compute_var_types(sqlcursor, rqlst, kwargs): rqlhelper.compute_solutions(rqlst, {'eid': eid_func_map}, kwargs=kwargs) class rqlhelper: @@ -602,7 +602,7 @@ args = {} union = parse(rql) # self.vreg.parse(rql, annotate=True) with self.admin_access.repo_cnx() as cnx: - self.vreg.solutions(cnx, union, args) + self.vreg.compute_var_types(cnx, union, args) self.vreg.rqlhelper.annotate(union) plan = self.repo.querier.plan_factory(union, args, cnx) plan.preprocess(union) diff -r 38fcf5707295 -r 3ddd03309315 cubicweb/web/views/magicsearch.py --- a/cubicweb/web/views/magicsearch.py Sun Feb 02 22:15:38 2020 +0100 +++ b/cubicweb/web/views/magicsearch.py Wed Mar 13 00:15:48 2019 +0100 @@ -454,7 +454,7 @@ user_rql = variables select = parse(user_rql, print_errors=False).children[0] req.vreg.rqlhelper.annotate(select) - req.vreg.solutions(req, select, {}) + req.vreg.compute_var_types(req, select, {}) if restrictions: return ['%s, %s' % (user_rql, suggestion) for suggestion in self.rql_build_suggestions(select, incomplete_part)]