diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-09-12 12:37:43 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-09-12 12:37:43 -0400 |
| commit | bad4493842caeba312403efb143144a91e562311 (patch) | |
| tree | 368c4d4cbc151afc59a3920b167ff5304c544868 /lib/sqlalchemy/orm/dependency.py | |
| parent | 9674b4bf176539400ba10de41c32186873d4dc13 (diff) | |
| download | sqlalchemy-bad4493842caeba312403efb143144a91e562311.tar.gz | |
- Slight improvement to the behavior of "passive_updates=False"
when placed only on the many-to-one side of a
relationship; documentation has been clarified
that passive_updates=False should really be on the
one-to-many side.
- Placing passive_deletes=True on a many-to-one emits
a warning, since you probably intended to put it on
the one-to-many side.
Diffstat (limited to 'lib/sqlalchemy/orm/dependency.py')
| -rw-r--r-- | lib/sqlalchemy/orm/dependency.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/dependency.py b/lib/sqlalchemy/orm/dependency.py index 376afd88d..662cfc67b 100644 --- a/lib/sqlalchemy/orm/dependency.py +++ b/lib/sqlalchemy/orm/dependency.py @@ -734,7 +734,12 @@ class DetectKeySwitch(DependencyProcessor): def per_property_preprocessors(self, uow): if self.prop._reverse_property: - return + if self.passive_updates: + return + else: + if False in (prop.passive_updates for \ + prop in self.prop._reverse_property): + return uow.register_preprocessor(self, False) @@ -797,14 +802,12 @@ class DetectKeySwitch(DependencyProcessor): if switchers: # if primary key values have actually changed somewhere, perform # a linear search through the UOW in search of a parent. - # note that this handler isn't used if the many-to-one - # relationship has a backref. for state in uowcommit.session.identity_map.all_states(): if not issubclass(state.class_, self.parent.class_): continue dict_ = state.dict - related = dict_.get(self.key) - if related is not None: + related = state.get_impl(self.key).get(state, dict_, passive=self.passive_updates) + if related is not attributes.PASSIVE_NO_RESULT and related is not None: related_state = attributes.instance_state(dict_[self.key]) if related_state in switchers: uowcommit.register_object(state, |
