diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-06-18 13:11:19 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-06-18 13:11:19 -0400 |
| commit | 1baca8908450ee56c87068fc5d87840208aac146 (patch) | |
| tree | 1f542ed12ffdee42aa15be8eca45b761243c2987 /lib/sqlalchemy/orm/dependency.py | |
| parent | 46e0138405778379848e6c6f2ab424388724e555 (diff) | |
| download | sqlalchemy-1baca8908450ee56c87068fc5d87840208aac146.tar.gz | |
adds some tests, refines out the m2o approach.
Diffstat (limited to 'lib/sqlalchemy/orm/dependency.py')
| -rw-r--r-- | lib/sqlalchemy/orm/dependency.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py index 4d7a03894..c9a0ce8ed 100644 --- a/lib/sqlalchemy/orm/dependency.py +++ b/lib/sqlalchemy/orm/dependency.py @@ -545,10 +545,11 @@ class ManyToOneDP(DependencyProcessor): uow.dependencies.update([ (child_saves, after_save), (parent_saves, after_save), - (before_delete, parent_deletes), - (before_delete, child_deletes), (after_save, child_post_updates), + + (after_save, child_pre_updates), (before_delete, child_pre_updates), + (child_pre_updates, child_deletes), ]) else: @@ -567,36 +568,30 @@ class ManyToOneDP(DependencyProcessor): isdelete, childisdelete): if self.post_update: - + if not isdelete: - child_post_updates = unitofwork.PostUpdateThing( + parent_post_updates = unitofwork.PostUpdateThing( uow, self.parent.primary_base_mapper, False) if childisdelete: uow.dependencies.update([ - (save_parent, after_save), - (after_save, child_action), # can remove - - (after_save, child_post_updates), - (child_post_updates, child_action) + (after_save, parent_post_updates), + (parent_post_updates, child_action) ]) else: uow.dependencies.update([ (save_parent, after_save), (child_action, after_save), - (after_save, child_post_updates) + (after_save, parent_post_updates) ]) else: - child_pre_updates = unitofwork.PostUpdateThing( + parent_pre_updates = unitofwork.PostUpdateThing( uow, self.parent.primary_base_mapper, True) uow.dependencies.update([ - (before_delete, delete_parent), # can remove - (before_delete, child_action), # can remove - - (before_delete, child_pre_updates), - (child_pre_updates, delete_parent), - (child_pre_updates, child_action) + (before_delete, parent_pre_updates), + (parent_pre_updates, delete_parent), + (parent_pre_updates, child_action) ]) elif not isdelete: |
