]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Updated UOWEventHandler so that it uses session.add() instead of session.save_or_upda...
authorMichael Trier <mtrier@gmail.com>
Tue, 28 Oct 2008 19:59:53 +0000 (19:59 +0000)
committerMichael Trier <mtrier@gmail.com>
Tue, 28 Oct 2008 19:59:53 +0000 (19:59 +0000)
lib/sqlalchemy/orm/unitofwork.py

index 103af451311b6a8f0abb0c1287f7557e99f5ad8c..0992bfe993592594d6337a5fb6e165a6796d1745 100644 (file)
@@ -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