diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-24 15:52:09 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2012-04-24 15:52:09 -0400 |
| commit | a66861031a85063c9de8874559815f7ee0bab998 (patch) | |
| tree | 3a1143e8dacd4f5c25fd4c8df17d3d27034ba0fc /lib/sqlalchemy | |
| parent | 59ce77ca93bc3a0af054fbead17e927172047165 (diff) | |
| download | sqlalchemy-a66861031a85063c9de8874559815f7ee0bab998.tar.gz | |
- [feature] The after_attach event is now
emitted after the object is established
in Session.new or Session.identity_map
upon Session.add(), Session.merge(),
etc., so that the object is represented
in these collections when the event
is called. [ticket:2464]
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/orm/session.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index ab9de70ea..7c2cd8f0e 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1460,10 +1460,10 @@ class Session(object): "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() state.insert_order = len(self._new) + self._attach(state) def _update_impl(self, state): if (self.identity_map.contains_state(state) and @@ -1481,9 +1481,9 @@ class Session(object): "function to send this object back to the transient state." % mapperutil.state_str(state) ) - self._attach(state) self._deleted.pop(state, None) self.identity_map.add(state) + self._attach(state) def _save_or_update_impl(self, state): if state.key is None: |
