diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-09-03 12:31:16 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-09-03 12:31:16 -0400 |
commit | 47f56ac4990c7c3e6a020a837e91e39f41adf39e (patch) | |
tree | 87a911cf8a5b9d11ec6ef6bb0b4af122f3eca57e /lib/sqlalchemy/orm/dynamic.py | |
parent | 6e9d62b46cc66dc674f86e25fee40fd36bf0d4c8 (diff) | |
download | sqlalchemy-47f56ac4990c7c3e6a020a837e91e39f41adf39e.tar.gz |
- get active_history to work, move attribute events into module-level classes
Diffstat (limited to 'lib/sqlalchemy/orm/dynamic.py')
-rw-r--r-- | lib/sqlalchemy/orm/dynamic.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/sqlalchemy/orm/dynamic.py b/lib/sqlalchemy/orm/dynamic.py index d55838011..918a0aabd 100644 --- a/lib/sqlalchemy/orm/dynamic.py +++ b/lib/sqlalchemy/orm/dynamic.py @@ -46,9 +46,10 @@ class DynamicAttributeImpl(attributes.AttributeImpl): supports_population = False def __init__(self, class_, key, typecallable, - target_mapper, order_by, query_class=None, **kwargs): + dispatch, + target_mapper, order_by, query_class=None, **kw): super(DynamicAttributeImpl, self).\ - __init__(class_, key, typecallable, **kwargs) + __init__(class_, key, typecallable, dispatch, **kw) self.target_mapper = target_mapper self.order_by = order_by if not query_class: @@ -78,8 +79,8 @@ class DynamicAttributeImpl(attributes.AttributeImpl): collection_history = self._modified_event(state, dict_) collection_history.added_items.append(value) - for ext in self.extensions: - ext.append(state, value, initiator or self) + for fn in self.dispatch.on_append: + value = fn(state, value, initiator or self) if self.trackparent and value is not None: self.sethasparent(attributes.instance_state(value), True) @@ -91,8 +92,8 @@ class DynamicAttributeImpl(attributes.AttributeImpl): if self.trackparent and value is not None: self.sethasparent(attributes.instance_state(value), False) - for ext in self.extensions: - ext.remove(state, value, initiator or self) + for fn in self.dispatch.on_remove: + fn(state, value, initiator or self) def _modified_event(self, state, dict_): |