diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-01 14:10:11 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-01 14:10:11 -0500 |
| commit | d30678d18de7828f03f8179d7980cab2e66c18bc (patch) | |
| tree | 65cc0185dd53af871ec8b2993ea2752475ae926b /examples/custom_attributes | |
| parent | df7379f992938af7ec05f0c46ccef3305ebcd5cc (diff) | |
| download | sqlalchemy-d30678d18de7828f03f8179d7980cab2e66c18bc.tar.gz | |
new calling style: event.listen(target, identifier, fn)
Diffstat (limited to 'examples/custom_attributes')
| -rw-r--r-- | examples/custom_attributes/listen_for_events.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/custom_attributes/listen_for_events.py b/examples/custom_attributes/listen_for_events.py index e66ebd090..0cf014c82 100644 --- a/examples/custom_attributes/listen_for_events.py +++ b/examples/custom_attributes/listen_for_events.py @@ -16,9 +16,9 @@ def configure_listener(class_, key, inst): def set_(instance, value, oldvalue, initiator): instance.receive_change_event("set", key, value, oldvalue) - event.listen(append, 'on_append', inst) - event.listen(remove, 'on_remove', inst) - event.listen(set_, 'on_set', inst) + event.listen(inst, 'on_append', append) + event.listen(inst, 'on_remove', remove) + event.listen(inst, 'on_set', set_) if __name__ == '__main__': @@ -38,7 +38,7 @@ if __name__ == '__main__': Base = declarative_base(cls=Base) - event.listen(configure_listener, 'on_attribute_instrument', Base) + event.listen(Base, 'on_attribute_instrument', configure_listener) class MyMappedClass(Base): __tablename__ = "mytable" |
