Fix iget_nodes not recursing into children once it found the right class

This shows up when working out whether a select has an aggregate function, if the aggregate function is inside a call to a non-aggregate. See https://www.cubicweb.org/ticket/10181470

Open question: should this be made conditional and the legacy behaviour kept by default?

authorJulien Cristau <julien.cristau@logilab.fr>
changesetfa10b6221e3a
branchdefault
phasedraft
hiddenno
parent revision#aa6c753b0a4e Added tag 0.34.0, centos/0.34.0-1, debian/0.34.0-1 for changeset 8411efb08f71
child revision<not specified>
files modified by this revision
rql/base.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1453394136 -3600
# Thu Jan 21 17:35:36 2016 +0100
# Node ID fa10b6221e3a82f596aa8810ca783ac2e5b65f83
# Parent aa6c753b0a4e1474a2604a6dd994df6ba6ce4596
Fix iget_nodes not recursing into children once it found the right class

This shows up when working out whether a select has an aggregate
function, if the aggregate function is inside a call to a non-aggregate.
See https://www.cubicweb.org/ticket/10181470

Open question: should this be made conditional and the legacy behaviour
kept by default?

diff --git a/rql/base.py b/rql/base.py
@@ -93,12 +93,11 @@
1          stack = [self]
2          while stack:
3              node = stack.pop()
4              if isinstance(node, klass):
5                  yield node
6 -            else:
7 -                stack += node.children
8 +            stack += node.children
9 
10      def is_equivalent(self, other):
11          if not other.__class__ is self.__class__:
12              return False
13          for i, child in enumerate(self.children):