summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/dynamic.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-12-14 05:53:18 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-12-14 05:53:18 +0000
commit0df750223a5f6ee4cfa987a4abd5ab4691007350 (patch)
tree89780e200d97f36a83d30c5da45122d211cb1075 /lib/sqlalchemy/orm/dynamic.py
parent273e48c9a95825541bd461a1d5402f2e65f95876 (diff)
downloadsqlalchemy-0df750223a5f6ee4cfa987a4abd5ab4691007350.tar.gz
- merged instances_yields branch r3908:3934, minus the "yield" part which remains slightly problematic
- cleanup of mapper._instance, query.instances(). mapper identifies objects which are part of the current load using a app-unique id on the query context. - attributes refactor; attributes now mostly use copy-on-modify instead of copy-on-load behavior, simplified get_history(), added a new set of tests - fixes to OrderedSet such that difference(), intersection() and others can accept an iterator - OrderedIdentitySet passes in OrderedSet to the IdentitySet superclass for usage in difference/intersection/etc. operations so that these methods actually work with ordering behavior. - query.order_by() takes into account aliased joins, i.e. query.join('orders', aliased=True).order_by(Order.id) - cleanup etc.
Diffstat (limited to 'lib/sqlalchemy/orm/dynamic.py')
-rw-r--r--lib/sqlalchemy/orm/dynamic.py24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/dynamic.py b/lib/sqlalchemy/orm/dynamic.py
index 63bdaea40..ea99d6514 100644
--- a/lib/sqlalchemy/orm/dynamic.py
+++ b/lib/sqlalchemy/orm/dynamic.py
@@ -17,13 +17,27 @@ class DynamicAttributeImpl(attributes.AttributeImpl):
else:
return AppenderQuery(self, state)
- def commit_to_state(self, state, value=attributes.NO_VALUE):
- # we have our own AttributeHistory therefore dont need CommittedState
- # instead, we reset the history stored on the attribute
- state.dict[self.key] = CollectionHistory(self, state)
-
def get_collection(self, state, user_data=None):
return self._get_collection(state, passive=True).added_items
+
+ def fire_append_event(self, state, value, initiator):
+ state.modified = True
+
+ if self.trackparent and value is not None:
+ self.sethasparent(value._state, True)
+ instance = state.obj()
+ for ext in self.extensions:
+ ext.append(instance, value, initiator or self)
+
+ def fire_remove_event(self, state, value, initiator):
+ state.modified = True
+
+ if self.trackparent and value is not None:
+ self.sethasparent(value._state, False)
+
+ instance = state.obj()
+ for ext in self.extensions:
+ ext.remove(instance, value, initiator or self)
def set(self, state, value, initiator):
if initiator is self: