summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/unitofwork.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/orm/unitofwork.py')
-rw-r--r--lib/sqlalchemy/orm/unitofwork.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/sqlalchemy/orm/unitofwork.py b/lib/sqlalchemy/orm/unitofwork.py
index 83703ba11..0c3f59562 100644
--- a/lib/sqlalchemy/orm/unitofwork.py
+++ b/lib/sqlalchemy/orm/unitofwork.py
@@ -147,10 +147,10 @@ class UOWTransaction(object):
self.states[state] = (isdelete, listonly)
elif isdelete or listonly:
existing_isdelete, existing_listonly = self.states[state]
- self.states[state] = (
- existing_isdelete or isdelete,
- existing_listonly and listonly
- )
+ if not listonly and existing_listonly:
+ raise Exception("Can't upgrade from listonly to save")
+ if existing_isdelete != isdelete:
+ raise Exception("Can't change delete flag")
def states_for_mapper(self, mapper, isdelete, listonly):
checktup = (isdelete, listonly)