diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-04-05 14:49:35 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-04-05 14:49:35 -0400 |
commit | 67b99a7bfae11b20b9b3c025f357ad366c4d991b (patch) | |
tree | 3d5995b9a600e245f8ee6ee47a192eeb59eb54ee /lib/sqlalchemy/orm/unitofwork.py | |
parent | ddb40afc6b5742341c2710a39e06128545752172 (diff) | |
download | sqlalchemy-67b99a7bfae11b20b9b3c025f357ad366c4d991b.tar.gz |
- enabled the DetectKeySwitch, and additionally added that it need
not execute at all when a one-to-many is present on the reverse side.
- OneToMany can establish a state as "listonly" when passive_updates are enabled
and the change is due to key switch.
Diffstat (limited to 'lib/sqlalchemy/orm/unitofwork.py')
-rw-r--r-- | lib/sqlalchemy/orm/unitofwork.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index 898be9139..83703ba11 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -146,7 +146,11 @@ class UOWTransaction(object): self.mappers[mapper].add(state) self.states[state] = (isdelete, listonly) elif isdelete or listonly: - self.states[state] = (isdelete, listonly) + existing_isdelete, existing_listonly = self.states[state] + self.states[state] = ( + existing_isdelete or isdelete, + existing_listonly and listonly + ) def states_for_mapper(self, mapper, isdelete, listonly): checktup = (isdelete, listonly) @@ -214,9 +218,9 @@ class UOWTransaction(object): # execute actions sort = topological.sort(self.dependencies, postsort_actions) - #print "------------------------" - #print self.dependencies - #print sort + print "------------------------" + print self.dependencies + print sort for rec in sort: rec.execute(self) @@ -231,7 +235,7 @@ class UOWTransaction(object): for state, (isdelete, listonly) in self.states.iteritems(): if isdelete: self.session._remove_newly_deleted(state) - elif not listonly: + else: #if not listonly: self.session._register_newly_persistent(state) log.class_logger(UOWTransaction) |