]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
- AttributeListener has been refined such that the event
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 2 Sep 2008 17:57:35 +0000 (17:57 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 2 Sep 2008 17:57:35 +0000 (17:57 +0000)
commit3e25e6e6b05c39b15deda65921d411ec8cb341ae
tree1b148b1597c6c63c5d2b987acac45032e8388edf
parentd578d67035c519d4205e757c926392896e6a57e7
- AttributeListener has been refined such that the event
is fired before the mutation actually occurs.  Addtionally,
the append() and set() methods must now return the given value,
which is used as the value to be used in the mutation operation.
This allows creation of validating AttributeListeners which
raise before the action actually occurs, and which can change
the given value into something else before its used.
A new example "validate_attributes.py" shows one such recipe
for doing this.   AttributeListener helper functions are
also on the way.
CHANGES
examples/custom_attributes/listen_for_events.py
examples/custom_attributes/validate_attributes.py [new file with mode: 0644]
lib/sqlalchemy/orm/attributes.py
lib/sqlalchemy/orm/collections.py
lib/sqlalchemy/orm/interfaces.py
lib/sqlalchemy/orm/unitofwork.py
test/orm/attributes.py
test/orm/collection.py