diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-02-20 18:24:46 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2013-02-20 18:24:46 -0500 |
| commit | 26fb4b81638189547dd24f525ad0d146f2646916 (patch) | |
| tree | ad77d18c6ea7246cfc34666459123e4432564361 /lib/sqlalchemy/orm/session.py | |
| parent | 6d1c473c4726533764e0d46446abb41c79109f10 (diff) | |
| download | sqlalchemy-26fb4b81638189547dd24f525ad0d146f2646916.tar.gz | |
- Added new helper function :func:`.was_deleted`, returns True
if the given object was the subject of a :meth:`.Session.delete`
operation.
- An object that's deleted from a session will be de-associated with
that session fully after the transaction is committed, that is
the :func:`.object_session` function will return None.
[ticket:2658]
Diffstat (limited to 'lib/sqlalchemy/orm/session.py')
| -rw-r--r-- | lib/sqlalchemy/orm/session.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index 00c6d4227..2915fd4c8 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -255,6 +255,10 @@ class SessionTransaction(object): if not self.nested and self.session.expire_on_commit: for s in self.session.identity_map.all_states(): s._expire(s.dict, self.session.identity_map._modified) + for s in self._deleted: + s.session_id = None + self._deleted.clear() + def _connection_for_bind(self, bind): self._assert_is_active() |
