summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/session.py4
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: