From: Michael Trier Date: Tue, 28 Oct 2008 19:59:53 +0000 (+0000) Subject: Updated UOWEventHandler so that it uses session.add() instead of session.save_or_upda... X-Git-Tag: rel_0_5rc3~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fc32d7825e9d9bf1dbcf3bbcd4cbf153e68fea5;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Updated UOWEventHandler so that it uses session.add() instead of session.save_or_update(). Fixes #1208. --- 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