# HG changeset patch # User Sylvain Thénault # Date 1288956162 -3600 # Node ID 674461009c7c13781ff4b4b507d96253e44395e6 # Parent b62ebf1d9388ed5cfcbfd8029f9c15bce3be8794 fix #1376317: facet: no_relation feature crash when rql has no restriction diff -r b62ebf1d9388 -r 674461009c7c web/facet.py --- a/web/facet.py Fri Nov 05 11:58:16 2010 +0100 +++ b/web/facet.py Fri Nov 05 12:22:42 2010 +0100 @@ -709,9 +709,18 @@ subj = self.filtered_variable.name obj = utils.rqlvar_maker(defined=self.rqlst.defined_vars, aliases=self.rqlst.aliases).next() - rql = 'Any %s LIMIT 1 WHERE NOT %s %s %s, %s' % ( - self.filtered_variable.name, subj, self.rtype, obj, - self.rqlst.where.as_string()) + restrictions = [] + if self.rqlst.where: + restrictions.append(self.rqlst.where.as_string()) + if self.rqlst.with_: + restrictions.append('WITH ' + ','.join( + term.as_string() for term in self.rqlst.with_)) + if restrictions: + restrictions = ',' + ','.join(restrictions) + else: + restrictions = '' + rql = 'Any %s LIMIT 1 WHERE NOT %s %s %s%s' % ( + self.filtered_variable.name, subj, self.rtype, obj, restrictions) try: return bool(self.rqlexec(rql, self.cw_rset and self.cw_rset.args)) except: