From: Mike Bayer Date: Tue, 25 Mar 2008 00:02:45 +0000 (+0000) Subject: a few more tweaks X-Git-Tag: rel_0_4_5~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=df1000839ba2925031afa2e9769a482add9f404e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git a few more tweaks --- diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index 57dfb4b96d..09d5a0982c 100644 --- a/lib/sqlalchemy/sql/visitors.py +++ b/lib/sqlalchemy/sql/visitors.py @@ -49,7 +49,7 @@ class ClauseVisitor(object): stack.append(c) def traverse(self, obj, clone=False): - """traverse the given expression structure. + """traverse and visit the given expression structure. Returns the structure given, or a copy of the structure if clone=True. @@ -151,7 +151,7 @@ class ClauseVisitor(object): """iterate through this visitor and each 'chained' visitor.""" v = self - while v is not None: + while v: yield v v = getattr(v, '_next', None) _iterate_visitors = property(_iterate_visitors) @@ -161,9 +161,7 @@ class ClauseVisitor(object): the chained visitor will receive all visit events after this one. """ - tail = self - while getattr(tail, '_next', None) is not None: - tail = tail._next + tail = list(self._iterate_visitors)[-1] tail._next = visitor return self