[rql2sql] fix potential crash when testing _q_invariant on a ColumnAlias instead of a Variable by always considering _q_invariant to false for them stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 04 Mar 2010 11:45:29 +0100
branchstable
changeset 4794 81075b09ebf1
parent 4792 e46c6e01117b
child 4797 c8d5fcc3d64a
child 4798 d5bd706e9005
child 4799 99e31d0ce391
[rql2sql] fix potential crash when testing _q_invariant on a ColumnAlias instead of a Variable by always considering _q_invariant to false for them
server/sources/rql2sql.py
--- a/server/sources/rql2sql.py	Thu Mar 04 10:56:46 2010 +0100
+++ b/server/sources/rql2sql.py	Thu Mar 04 11:45:29 2010 +0100
@@ -41,6 +41,8 @@
 from cubicweb.server.sqlutils import SQL_PREFIX
 from cubicweb.server.utils import cleanup_solutions
 
+ColumnAlias._q_invariant = False # avoid to check for ColumnAlias / Variable
+
 def _new_var(select, varname):
     newvar = select.get_variable(varname)
     if not 'relations' in newvar.stinfo:
@@ -711,7 +713,7 @@
         return '%s=%s' % (lhssql, rhsvar.accept(self))
 
     def _process_relation_term(self, relation, rid, termvar, termconst, relfield):
-        if termconst or isinstance(termvar, ColumnAlias) or not termvar._q_invariant:
+        if termconst or not termvar._q_invariant:
             termsql = termconst and termconst.accept(self) or termvar.accept(self)
             yield '%s.%s=%s' % (rid, relfield, termsql)
         elif termvar._q_invariant: