MCPcopy
hub / github.com/django/django / set_rollback

Function set_rollback

django/db/transaction.py:96–108  ·  view source on GitHub ↗

Set or unset the "needs rollback" flag -- for *advanced use* only. When `rollback` is `True`, trigger a rollback when exiting the innermost enclosing atomic block that has `savepoint=True` (that's the default). Use this to force a rollback without raising an exception. When `r

(rollback, using=None)

Source from the content-addressed store, hash-verified

94
95
96def set_rollback(rollback, using=None):
97 """
98 Set or unset the "needs rollback" flag -- for *advanced use* only.
99
100 When `rollback` is `True`, trigger a rollback when exiting the innermost
101 enclosing atomic block that has `savepoint=True` (that's the default). Use
102 this to force a rollback without raising an exception.
103
104 When `rollback` is `False`, prevent such a rollback. Use this only after
105 rolling back to a known-good state! Otherwise, you break the atomic block
106 and data corruption may occur.
107 """
108 return get_connection(using).set_rollback(rollback)
109
110
111@contextmanager

Callers

nothing calls this directly

Calls 2

set_rollbackMethod · 0.80
get_connectionFunction · 0.70

Tested by

no test coverage detected