mirror of
https://github.com/django/django.git
synced 2025-12-07 18:26:41 +00:00
Correct scoping of savepoint example
This commit is contained in:
parent
57554442fe
commit
27f68f8659
1 changed files with 1 additions and 1 deletions
|
|
@ -492,8 +492,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…
Add table
Add a link
Reference in a new issue