diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-08-24 21:31:00 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-08-24 21:31:00 +0000 |
| commit | 34ecc552614143fb8f90ccc74b78fe8e3bdd7fb5 (patch) | |
| tree | 590789944848b8b8f8653144aef8407e2e72bf6c /lib | |
| parent | ae573e047a696c3c80d11e56466c9f55b72e0461 (diff) | |
| download | sqlalchemy-34ecc552614143fb8f90ccc74b78fe8e3bdd7fb5.tar.gz | |
- Session.delete() adds the given object to the session if
not already present. This was a regression bug from 0.4
[ticket:1150]
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/orm/session.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index bd271e96d..20bb85e80 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1241,6 +1241,7 @@ class Session(object): raise sa_exc.InvalidRequestError( "Object '%s' already has an identity - it can't be registered " "as pending" % mapperutil.state_str(state)) + self._attach(state) if state not in self._new: self._new[state] = state.obj() @@ -1290,8 +1291,9 @@ class Session(object): "different identity" % (mapperutil.state_str(state), state.key)) - self._deleted[state] = state.obj() self._attach(state) + self._deleted[state] = state.obj() + self.identity_map.add(state) def _attach(self, state): if state.session_id and state.session_id is not self.hash_key: |
