diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-03-25 00:02:45 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-03-25 00:02:45 +0000 |
commit | df1000839ba2925031afa2e9769a482add9f404e (patch) | |
tree | 4b0121e519058549848fc9194b59ed8f60dba0b1 | |
parent | bade0092d13de5c28b9bcccdaaa5b9b6e00e1ed2 (diff) | |
download | sqlalchemy-df1000839ba2925031afa2e9769a482add9f404e.tar.gz |
a few more tweaks
-rw-r--r-- | lib/sqlalchemy/sql/visitors.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/sqlalchemy/sql/visitors.py b/lib/sqlalchemy/sql/visitors.py index 57dfb4b96..09d5a0982 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 |