From: Mike Bayer Date: Mon, 18 May 2009 16:21:42 +0000 (+0000) Subject: - Fixed an attribute error introduced in 0.5.4 which would X-Git-Tag: rel_0_5_4p1 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=7ff23a5218e05ae7e543e31f18b1a3fbe650e4cb;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Fixed an attribute error introduced in 0.5.4 which would occur when merge() was used with an incomplete object. --- diff --git a/CHANGES b/CHANGES index 6074c83d8d..165d2ec079 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,13 @@ CHANGES ======= +0.5.4p1 +======= + +- orm + - Fixed an attribute error introduced in 0.5.4 which would + occur when merge() was used with an incomplete object. + 0.5.4 ===== diff --git a/lib/sqlalchemy/__init__.py b/lib/sqlalchemy/__init__.py index b28de9bc8f..5502aa7b84 100644 --- a/lib/sqlalchemy/__init__.py +++ b/lib/sqlalchemy/__init__.py @@ -107,6 +107,6 @@ from sqlalchemy.engine import create_engine, engine_from_config __all__ = sorted(name for name, obj in locals().items() if not (name.startswith('_') or inspect.ismodule(obj))) -__version__ = '0.5.4' +__version__ = '0.5.4p1' del inspect, sys diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 4fa41ff3b5..4fe562110d 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -376,7 +376,7 @@ class AttributeImpl(object): return self.set_committed_value(state, dict_, value) else: if self.key not in dict_: - return self.get(state, passive=passive) + return self.get(state, dict_, passive=passive) return dict_[self.key] # Return a new, empty value diff --git a/test/orm/merge.py b/test/orm/merge.py index b0e236ba2b..fd553f2bf7 100644 --- a/test/orm/merge.py +++ b/test/orm/merge.py @@ -220,6 +220,15 @@ class MergeTest(_fixtures.FixtureTest): Address(email_address='hoho@bar.com')])) eq_(on_load.called, 6) + @testing.resolve_artifact_names + def test_merge_empty_attributes(self): + mapper(User, dingalings) + u1 = User(id=1) + sess = create_session() + sess.merge(u1) + sess.flush() + assert u1.address_id is u1.data is None + @testing.resolve_artifact_names def test_attribute_cascade(self): """Merge of a persistent entity with two child persistent entities."""