diff options
| author | Anssi Kääriäinen <akaariai@gmail.com> | 2013-02-05 23:52:29 +0200 |
|---|---|---|
| committer | Anssi Kääriäinen <akaariai@gmail.com> | 2013-02-10 13:55:54 +0200 |
| commit | a4e97cf315142e61bb4bc3ed8259b95d8586d09c (patch) | |
| tree | 7f21b7043e9a05a2dae6d8c833f98cb68f1c7fc9 /django/db/backends | |
| parent | 0e18fb04bad99de237b5eb8ea4f9ff2f3cd147d3 (diff) | |
Fixed #19707 -- Reset transaction state after requests
Diffstat (limited to 'django/db/backends')
| -rw-r--r-- | django/db/backends/__init__.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index 7dc5456827..bbb5a5b294 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -88,6 +88,17 @@ class BaseDatabaseWrapper(object): return self.cursor().execute(self.ops.savepoint_commit_sql(sid)) + def abort(self): + """ + Roll back any ongoing transaction and clean the transaction state + stack. + """ + if self._dirty: + self._rollback() + self._dirty = False + while self.transaction_state: + self.leave_transaction_management() + def enter_transaction_management(self, managed=True): """ Enters transaction management for a running thread. It must be balanced with |
