summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/orm/unitofwork.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-04-05 14:53:19 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2010-04-05 14:53:19 -0400
commit233756a018dd54aa611ec8147bfda09a3c16268e (patch)
tree8b9d4ed93d465329db67cf499a81fd0399715a50 /lib/sqlalchemy/orm/unitofwork.py
parent67b99a7bfae11b20b9b3c025f357ad366c4d991b (diff)
downloadsqlalchemy-233756a018dd54aa611ec8147bfda09a3c16268e.tar.gz
these are some assertions that would make things easier, if they can be maintained.
otherwise, if listonly can go from True to False, then there's the whole cascades issue to deal with, same for delete moving from False to True and vice versa.
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)