summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/attributes.py14
-rw-r--r--lib/sqlalchemy/orm/collections.py2
-rw-r--r--lib/sqlalchemy/orm/dynamic.py2
3 files changed, 9 insertions, 9 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py
index 33069332d..b56de5f05 100644
--- a/lib/sqlalchemy/orm/attributes.py
+++ b/lib/sqlalchemy/orm/attributes.py
@@ -455,7 +455,7 @@ class ScalarAttributeImpl(AttributeImpl):
self, state, dict_.get(self.key, NO_VALUE))
def set(self, state, dict_, value, initiator, passive=PASSIVE_OFF):
- if initiator is self:
+ if initiator and initiator.parent_token is self.parent_token:
return
if self.active_history:
@@ -534,7 +534,7 @@ class MutableScalarAttributeImpl(ScalarAttributeImpl):
state.mutable_dict.pop(self.key)
def set(self, state, dict_, value, initiator, passive=PASSIVE_OFF):
- if initiator is self:
+ if initiator and initiator.parent_token is self.parent_token:
return
if self.extensions:
@@ -596,7 +596,7 @@ class ScalarObjectAttributeImpl(ScalarAttributeImpl):
setter operation.
"""
- if initiator is self:
+ if initiator and initiator.parent_token is self.parent_token:
return
if self.active_history:
@@ -622,7 +622,7 @@ class ScalarObjectAttributeImpl(ScalarAttributeImpl):
previous is not None and
previous is not PASSIVE_NO_RESULT):
self.sethasparent(instance_state(previous), False)
-
+
for ext in self.extensions:
value = ext.set(state, value, previous, initiator or self)
@@ -726,7 +726,7 @@ class CollectionAttributeImpl(AttributeImpl):
self.key, state, self.collection_factory)
def append(self, state, dict_, value, initiator, passive=PASSIVE_OFF):
- if initiator is self:
+ if initiator and initiator.parent_token is self.parent_token:
return
collection = self.get_collection(state, dict_, passive=passive)
@@ -739,7 +739,7 @@ class CollectionAttributeImpl(AttributeImpl):
collection.append_with_event(value, initiator)
def remove(self, state, dict_, value, initiator, passive=PASSIVE_OFF):
- if initiator is self:
+ if initiator and initiator.parent_token is self.parent_token:
return
collection = self.get_collection(state, state.dict, passive=passive)
@@ -759,7 +759,7 @@ class CollectionAttributeImpl(AttributeImpl):
setter operation.
"""
- if initiator is self:
+ if initiator and initiator.parent_token is self.parent_token:
return
self._set_iterable(
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py
index 0789d9626..b52329523 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -587,7 +587,7 @@ class CollectionAdapter(object):
def fire_append_event(self, item, initiator=None):
"""Notify that a entity has entered the collection.
- Initiator is the InstrumentedAttribute that initiated the membership
+ Initiator is a token owned by the InstrumentedAttribute that initiated the membership
mutation, and should be left as None unless you are passing along
an initiator value from a chained operation.
diff --git a/lib/sqlalchemy/orm/dynamic.py b/lib/sqlalchemy/orm/dynamic.py
index d55838011..c5ddaca40 100644
--- a/lib/sqlalchemy/orm/dynamic.py
+++ b/lib/sqlalchemy/orm/dynamic.py
@@ -112,7 +112,7 @@ class DynamicAttributeImpl(attributes.AttributeImpl):
def set(self, state, dict_, value, initiator,
passive=attributes.PASSIVE_OFF):
- if initiator is self:
+ if initiator and initiator.parent_token is self.parent_token:
return
self._set_iterable(state, dict_, value)