From f10eb28d90cbf73f4757897f52bf26722f98372e Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Mon, 23 Jun 2014 19:50:23 -0400 Subject: - reverse course in #3061 so that we instead no longer set None in the attribute when we do a get; we return the None as always but we leave the dict blank and the loader callable still in place. The case for this implicit get on a pending object is not super common and there really should be no change in state at all when this operation proceeds. This change is more dramatic as it reverses a behavior SQLA has had since the first release. fixes #3061 --- lib/sqlalchemy/orm/attributes.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'lib/sqlalchemy') diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index df1f328b7..fecd74f30 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -556,15 +556,7 @@ class AttributeImpl(object): def initialize(self, state, dict_): """Initialize the given state's attribute with an empty value.""" - old = NEVER_SET - value = None - if self.dispatch.set: - value = self.fire_replace_event(state, dict_, - None, old, None) - state._modified_event(dict_, self, old) - - dict_[self.key] = value - return value + return None def get(self, state, dict_, passive=PASSIVE_OFF): """Retrieve a value from the given object. -- cgit v1.2.1