[1.6.x] Corrected scoping of savepoint example
Backport of 27f68f8659a648cc9ed3e71f690959ed8a130c5a from master
This commit is contained in:
parent
0e3626260d
commit
d237aaa929
@ -522,8 +522,8 @@ you can roll back the single offending operation, rather than the entire
|
|||||||
transaction. For example::
|
transaction. For example::
|
||||||
|
|
||||||
a.save() # Succeeds, and never undone by savepoint rollback
|
a.save() # Succeeds, and never undone by savepoint rollback
|
||||||
try:
|
|
||||||
sid = transaction.savepoint()
|
sid = transaction.savepoint()
|
||||||
|
try:
|
||||||
b.save() # Could throw exception
|
b.save() # Could throw exception
|
||||||
transaction.savepoint_commit(sid)
|
transaction.savepoint_commit(sid)
|
||||||
except IntegrityError:
|
except IntegrityError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user