From 806f5a4183681582f1baabe02e7c5b4473c294ff Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Thu, 4 Jul 2013 20:01:55 -0400 Subject: Fixed bug whereby attribute history functions would fail when an object we moved from "persistent" to "pending" using the :func:`.make_transient` function, for operations involving collection-based backrefs. [ticket:2773] --- lib/sqlalchemy/orm/attributes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 2627a1c44..a4e5977a9 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -881,7 +881,7 @@ class CollectionAttributeImpl(AttributeImpl): if self.key in state.committed_state: original = state.committed_state[self.key] - if original is not NO_VALUE: + if original not in (NO_VALUE, NEVER_SET): current_states = [((c is not None) and instance_state(c) or None, c) for c in current] @@ -1324,7 +1324,7 @@ class History(History): return cls((), (), ()) current = getattr(current, '_sa_adapter') - if original is NO_VALUE: + if original in (NO_VALUE, NEVER_SET): return cls(list(current), (), ()) elif original is _NO_HISTORY: return cls((), list(current), ()) -- cgit v1.2.1