diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-31 12:55:42 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-03-31 12:55:42 -0400 |
| commit | b1fb11dda0454ca9738338e7cc549547c158222b (patch) | |
| tree | e01ee674d65e7fad032587cd9c55f64b613afd37 /lib | |
| parent | 7142a17291deba2eb9d4a2b30e1635129c2284ea (diff) | |
| download | sqlalchemy-b1fb11dda0454ca9738338e7cc549547c158222b.tar.gz | |
- [bug] Fixed bug whereby polymorphic_on
column that's not otherwise mapped on the
class would be incorrectly included
in a merge() operation, raising an error.
[ticket:2449]
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/orm/properties.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index 59c4cb3dc..74ccf0157 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -136,7 +136,9 @@ class ColumnProperty(StrategizedProperty): def merge(self, session, source_state, source_dict, dest_state, dest_dict, load, _recursive): - if self.key in source_dict: + if not self.instrument: + return + elif self.key in source_dict: value = source_dict[self.key] if not load: @@ -144,9 +146,8 @@ class ColumnProperty(StrategizedProperty): else: impl = dest_state.get_impl(self.key) impl.set(dest_state, dest_dict, value, None) - else: - if dest_state.has_identity and self.key not in dest_dict: - dest_state.expire_attributes(dest_dict, [self.key]) + elif dest_state.has_identity and self.key not in dest_dict: + dest_state.expire_attributes(dest_dict, [self.key]) class Comparator(PropComparator): @util.memoized_instancemethod |
