diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-02 14:23:42 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-01-02 14:23:42 -0500 |
| commit | 350aed3fdb9f1e73e69655e53f44ca6a91c196da (patch) | |
| tree | 3d2a128667b5f6ca6d0b4e1f4865fc98aac6b60b /examples/custom_attributes | |
| parent | 71f92436bdc86f30e2c21d8f5244733601e8c39e (diff) | |
| download | sqlalchemy-350aed3fdb9f1e73e69655e53f44ca6a91c196da.tar.gz | |
- whitespace removal bonanza
Diffstat (limited to 'examples/custom_attributes')
| -rw-r--r-- | examples/custom_attributes/custom_management.py | 2 | ||||
| -rw-r--r-- | examples/custom_attributes/listen_for_events.py | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/examples/custom_attributes/custom_management.py b/examples/custom_attributes/custom_management.py index 2e2689140..644d512cf 100644 --- a/examples/custom_attributes/custom_management.py +++ b/examples/custom_attributes/custom_management.py @@ -87,7 +87,7 @@ class MyClass(object): class MyCollectionAdapter(object): """An wholly alternative instrumentation implementation.""" - + def __init__(self, key, state, collection): self.key = key self.state = state diff --git a/examples/custom_attributes/listen_for_events.py b/examples/custom_attributes/listen_for_events.py index 2899f7fb1..80a33c0d8 100644 --- a/examples/custom_attributes/listen_for_events.py +++ b/examples/custom_attributes/listen_for_events.py @@ -28,21 +28,21 @@ if __name__ == '__main__': from sqlalchemy.ext.declarative import declarative_base class Base(object): - + def receive_change_event(self, verb, key, value, oldvalue): s = "Value '%s' %s on attribute '%s', " % (value, verb, key) if oldvalue: s += "which replaced the value '%s', " % oldvalue s += "on object %s" % self print s - + Base = declarative_base(cls=Base) event.listen(Base, 'attribute_instrument', configure_listener) class MyMappedClass(Base): __tablename__ = "mytable" - + id = Column(Integer, primary_key=True) data = Column(String(50)) related_id = Column(Integer, ForeignKey("related.id")) @@ -50,7 +50,7 @@ if __name__ == '__main__': def __str__(self): return "MyMappedClass(data=%r)" % self.data - + class Related(Base): __tablename__ = "related" @@ -59,12 +59,12 @@ if __name__ == '__main__': def __str__(self): return "Related(data=%r)" % self.data - + # classes are instrumented. Demonstrate the events ! - + m1 = MyMappedClass(data='m1', related=Related(data='r1')) m1.data = 'm1mod' m1.related.mapped.append(MyMappedClass(data='m2')) del m1.data - - + + |
