diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-16 20:32:56 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-12-16 20:32:56 +0000 |
| commit | 420c098d56e9925b51067711c6817475165c6af2 (patch) | |
| tree | 59af5b7717b17ddb3832515c374675b670d32181 /lib/sqlalchemy | |
| parent | 30b6d53b6daa46b0319d2974261b9c77c67f3d88 (diff) | |
| download | sqlalchemy-420c098d56e9925b51067711c6817475165c6af2.tar.gz | |
fixed del history
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/attributes.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 4f10ecc22..677167c1b 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -256,6 +256,9 @@ class ScalarAttributeImpl(AttributeImpl): accepts_global_callable = True def delete(self, state): + if self.key not in state.committed_state: + state.committed_state[self.key] = state.dict.get(self.key, NO_VALUE) + del state.dict[self.key] state.modified=True @@ -968,7 +971,11 @@ def _create_history(attr, state, current): return (list(collection.difference(s)), list(collection.intersection(s)), list(s.difference(collection))) else: if current is NO_VALUE: - return ([], [], []) + if original not in [None, NEVER_SET, NO_VALUE]: + deleted = [original] + else: + deleted = [] + return ([], [], deleted) elif original is NO_VALUE: return ([current], [], []) elif original is NEVER_SET or attr.is_equal(current, original) is True: # dont let ClauseElement expressions here trip things up |
