diff options
| author | Anton Samarchyan <anton.samarchyan@savoirfairelinux.com> | 2017-01-24 18:04:12 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-02-28 09:17:27 -0500 |
| commit | 60e52a047e55bc4cd5a93a8bd4d07baed27e9a22 (patch) | |
| tree | 010a363968b1ed41adf2e64c98d572d7148a2a5e /django/db/transaction.py | |
| parent | d6e26e5b7c8063c2cc5aa045edea6555bf358fc2 (diff) | |
Refs #27656 -- Updated django.db docstring verbs according to PEP 257.
Diffstat (limited to 'django/db/transaction.py')
| -rw-r--r-- | django/db/transaction.py | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/django/db/transaction.py b/django/db/transaction.py index b83aaa6440..ded74ce26a 100644 --- a/django/db/transaction.py +++ b/django/db/transaction.py @@ -6,9 +6,7 @@ from django.db import ( class TransactionManagementError(ProgrammingError): - """ - This exception is thrown when transaction management is used improperly. - """ + """Transaction management is used improperly.""" pass @@ -23,37 +21,29 @@ def get_connection(using=None): def get_autocommit(using=None): - """ - Get the autocommit status of the connection. - """ + """Get the autocommit status of the connection.""" return get_connection(using).get_autocommit() def set_autocommit(autocommit, using=None): - """ - Set the autocommit status of the connection. - """ + """Set the autocommit status of the connection.""" return get_connection(using).set_autocommit(autocommit) def commit(using=None): - """ - Commits a transaction. - """ + """Commit a transaction.""" get_connection(using).commit() def rollback(using=None): - """ - Rolls back a transaction. - """ + """Roll back a transaction.""" get_connection(using).rollback() def savepoint(using=None): """ - Creates a savepoint (if supported and required by the backend) inside the - current transaction. Returns an identifier for the savepoint that will be + Create a savepoint (if supported and required by the backend) inside the + current transaction. Return an identifier for the savepoint that will be used for the subsequent rollback or commit. """ return get_connection(using).savepoint() @@ -61,7 +51,7 @@ def savepoint(using=None): def savepoint_rollback(sid, using=None): """ - Rolls back the most recent savepoint (if one exists). Does nothing if + Roll back the most recent savepoint (if one exists). Do nothing if savepoints are not supported. """ get_connection(using).savepoint_rollback(sid) @@ -69,7 +59,7 @@ def savepoint_rollback(sid, using=None): def savepoint_commit(sid, using=None): """ - Commits the most recent savepoint (if one exists). Does nothing if + Commit the most recent savepoint (if one exists). Do nothing if savepoints are not supported. """ get_connection(using).savepoint_commit(sid) @@ -77,29 +67,27 @@ def savepoint_commit(sid, using=None): def clean_savepoints(using=None): """ - Resets the counter used to generate unique savepoint ids in this thread. + Reset the counter used to generate unique savepoint ids in this thread. """ get_connection(using).clean_savepoints() def get_rollback(using=None): - """ - Gets the "needs rollback" flag -- for *advanced use* only. - """ + """Get the "needs rollback" flag -- for *advanced use* only.""" return get_connection(using).get_rollback() def set_rollback(rollback, using=None): """ - Sets or unsets the "needs rollback" flag -- for *advanced use* only. + Set or unset the "needs rollback" flag -- for *advanced use* only. - When `rollback` is `True`, it triggers 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 `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 `rollback` is `False`, it prevents such a rollback. Use this only - after rolling back to a known-good state! Otherwise, you break the atomic - block and data corruption may occur. + When `rollback` is `False`, prevent such a rollback. Use this only after + rolling back to a known-good state! Otherwise, you break the atomic block + and data corruption may occur. """ return get_connection(using).set_rollback(rollback) @@ -118,7 +106,7 @@ def on_commit(func, using=None): class Atomic(ContextDecorator): """ - This class guarantees the atomic execution of a given block. + Guarantee the atomic execution of a given block. An instance can be used either as a decorator or as a context manager. |
