From 0fc32d7825e9d9bf1dbcf3bbcd4cbf153e68fea5 Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Tue, 28 Oct 2008 19:59:53 +0000 Subject: [PATCH] Updated UOWEventHandler so that it uses session.add() instead of session.save_or_update(). Fixes #1208. --- lib/sqlalchemy/orm/unitofwork.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py index 103af45131..0992bfe993 100644 --- a/lib/sqlalchemy/orm/unitofwork.py +++ b/lib/sqlalchemy/orm/unitofwork.py @@ -43,7 +43,7 @@ class UOWEventHandler(interfaces.AttributeExtension): if sess: prop = _state_mapper(state).get_property(self.key) if prop.cascade.save_update and item not in sess: - sess.save_or_update(item) + sess.add(item) return item def remove(self, state, item, initiator): @@ -64,7 +64,7 @@ class UOWEventHandler(interfaces.AttributeExtension): if sess: prop = _state_mapper(state).get_property(self.key) if newvalue is not None and prop.cascade.save_update and newvalue not in sess: - sess.save_or_update(newvalue) + sess.add(newvalue) if prop.cascade.delete_orphan and oldvalue in sess.new: sess.expunge(oldvalue) return newvalue -- 2.47.3