diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-05-02 23:51:01 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-05-02 23:51:01 +0000 |
commit | 612c49f545b5374be45dbb4da21a5d708ebb894f (patch) | |
tree | b1dacbcdb79b6d7bed5c39019dcfd153ff6cec44 /lib/sqlalchemy/sql.py | |
parent | bb7a29d6228b4cdefb3d85b204c46a87e898e34c (diff) | |
download | sqlalchemy-612c49f545b5374be45dbb4da21a5d708ebb894f.tar.gz |
- Aliasizer removed. hooray !
- ClauseVisitor has handy chain() method.
Diffstat (limited to 'lib/sqlalchemy/sql.py')
-rw-r--r-- | lib/sqlalchemy/sql.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index ab64d6528..fe987cc11 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -828,7 +828,21 @@ class ClauseVisitor(object): def traverse(self, obj): for n in obj.get_children(**self.__traverse_options__): self.traverse(n) - obj.accept_visitor(self) + v = self + while v is not None: + obj.accept_visitor(v) + v = getattr(v, '_next', None) + + def chain(self, visitor): + """'chain' an additional ClauseVisitor onto this ClauseVisitor. + + 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._next = visitor + return self + def visit_column(self, column): pass def visit_table(self, table): |