summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-02-15 02:07:06 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-02-15 02:07:06 +0000
commit40a29d198ab9a6e1e09c2eac8bff311c8a5def28 (patch)
treedde0f6639925e04d9d4fbeaab42251d173743bd4 /lib
parent66a74c136fbb16e81efeb3e4e42c8e6dc7519dd1 (diff)
downloadsqlalchemy-40a29d198ab9a6e1e09c2eac8bff311c8a5def28.tar.gz
- some cleanup to the unitofwork test suite (needs much more)
- fixed relationship deletion error when one-to-many child item is moved to a new parent in a single unit of work [ticket:478]
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/dependency.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py
index 4e4385ef1..a8d8ad507 100644
--- a/lib/sqlalchemy/orm/dependency.py
+++ b/lib/sqlalchemy/orm/dependency.py
@@ -41,6 +41,10 @@ class DependencyProcessor(object):
self._compile_synchronizers()
+ def _get_instrumented_attribute(self):
+ """return the InstrumentedAttribute handled by this DependencyProecssor"""
+ return getattr(self.parent.class_, self.key)
+
def register_dependencies(self, uowcommit):
"""tells a UOWTransaction what mappers are dependent on which, with regards
to the two or three mappers handled by this PropertyLoader.
@@ -148,7 +152,7 @@ class OneToManyDP(DependencyProcessor):
self._synchronize(obj, child, None, False, uowcommit)
self._conditional_post_update(child, uowcommit, [obj])
for child in childlist.deleted_items():
- if not self.cascade.delete_orphan:
+ if not self.cascade.delete_orphan and not self._get_instrumented_attribute().hasparent(child):
self._synchronize(obj, child, None, True, uowcommit)
def preprocess_dependencies(self, task, deplist, uowcommit, delete = False):