From abc33bd32d6fd11f46bdc3e65ce97b606ce1cb89 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sun, 16 Dec 2007 18:32:25 +0000 Subject: - more fixes to the LIMIT/OFFSET aliasing applied with Query + eagerloads, in this case when mapped against a select statement [ticket:904] - _hide_froms logic in expression totally localized to Join class, including search through previous clone sources - removed "stop_on" from main visitors, not used - "stop_on" in AbstractClauseProcessor part of constructor, ClauseAdapter sets it up based on given clause - fixes to is_derived_from() to take previous clone sources into account, Alias takes self + cloned sources into account. this is ultimately what the #904 bug was. --- lib/sqlalchemy/sql/visitors.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'lib/sqlalchemy/sql/visitors.py') diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index 150ee9cc7..bb63ab09c 100644 --- a/lib/sqlalchemy/sql/visitors.py +++ b/lib/sqlalchemy/sql/visitors.py @@ -37,18 +37,17 @@ class ClauseVisitor(object): meth(obj, **kwargs) v = getattr(v, '_next', None) - def iterate(self, obj, stop_on=None): + def iterate(self, obj): stack = [obj] traversal = [] while len(stack) > 0: t = stack.pop() - if stop_on is None or t not in stop_on: - yield t - traversal.insert(0, t) - for c in t.get_children(**self.__traverse_options__): - stack.append(c) + yield t + traversal.insert(0, t) + for c in t.get_children(**self.__traverse_options__): + stack.append(c) - def traverse(self, obj, stop_on=None, clone=False): + def traverse(self, obj, clone=False): if clone: cloned = {} @@ -60,17 +59,15 @@ class ClauseVisitor(object): return cloned[obj] obj = do_clone(obj) - stack = [obj] traversal = [] while len(stack) > 0: t = stack.pop() - if stop_on is None or t not in stop_on: - traversal.insert(0, t) - if clone: - t._copy_internals(clone=do_clone) - for c in t.get_children(**self.__traverse_options__): - stack.append(c) + traversal.insert(0, t) + if clone: + t._copy_internals(clone=do_clone) + for c in t.get_children(**self.__traverse_options__): + stack.append(c) for target in traversal: v = self while v is not None: -- cgit v1.2.1