[rql2sql] fix potential crash when testing _q_invariant on a ColumnAlias instead of a Variable by always considering _q_invariant to false for them
--- 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: