diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-05-08 16:09:48 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-05-08 16:09:48 -0400 |
commit | 6ea6673376609ce6a5e26f9f20425cffee96bcd8 (patch) | |
tree | 937024d0317d18d6fdffbbca7ee32b2449162242 /lib/sqlalchemy/orm/session.py | |
parent | 7009a3bc32daadf078e2806622615c665105240e (diff) | |
download | sqlalchemy-6ea6673376609ce6a5e26f9f20425cffee96bcd8.tar.gz |
- session.merge() will not expire attributes on the returned
instance if that instance is "pending". [ticket:1789]
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
-rw-r--r-- | lib/sqlalchemy/orm/session.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index 42b1b3cb5..713cd8c3d 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -17,7 +17,7 @@ from sqlalchemy.orm import ( from sqlalchemy.orm.util import object_mapper as _object_mapper from sqlalchemy.orm.util import class_mapper as _class_mapper from sqlalchemy.orm.util import ( - _class_to_mapper, _state_has_identity, _state_mapper, + _class_to_mapper, _state_mapper, ) from sqlalchemy.orm.mapper import Mapper, _none_set from sqlalchemy.orm.unitofwork import UOWTransaction @@ -1018,9 +1018,9 @@ class Session(object): if state.key is None: state.key = instance_key elif state.key != instance_key: - # primary key switch. - # use discard() in case another state has already replaced this - # one in the identity map (see test/orm/test_naturalpks.py ReversePKsTest) + # primary key switch. use discard() in case another + # state has already replaced this one in the identity + # map (see test/orm/test_naturalpks.py ReversePKsTest) self.identity_map.discard(state) state.key = instance_key @@ -1396,7 +1396,7 @@ class Session(object): for state in proc: is_orphan = _state_mapper(state)._is_orphan(state) - if is_orphan and not _state_has_identity(state): + if is_orphan and not state.has_identity: path = ", nor ".join( ["any parent '%s' instance " "via that classes' '%s' attribute" % |