From ebbae4fa0a936f6a4446bc7b4e165ff969d29fd0 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 29 Aug 2008 15:41:43 +0000 Subject: [PATCH] check extensions each time; user-defined code will be appending to "extensions" after the AttributeImpl has been constructed --- lib/sqlalchemy/orm/attributes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 0b36d5f0cd..2d7c726a1f 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -243,7 +243,7 @@ class AttributeImpl(object): else: self.is_equal = compare_function self.extensions = util.to_list(extension or []) - self.active_history = active_history or bool(self.extensions) + self.active_history = active_history def hasparent(self, state, optimistic=False): """Return the boolean value of a `hasparent` flag attached to the given item. @@ -374,7 +374,7 @@ class ScalarAttributeImpl(AttributeImpl): def delete(self, state): # TODO: catch key errors, convert to attributeerror? - if self.active_history: + if self.active_history or self.extensions: old = self.get(state) else: old = state.dict.get(self.key, NO_VALUE) @@ -395,7 +395,7 @@ class ScalarAttributeImpl(AttributeImpl): if initiator is self: return - if self.active_history: + if self.active_history or self.extensions: old = self.get(state) else: old = state.dict.get(self.key, NO_VALUE) -- 2.47.3