Ticket #13870: django-terminate-isolating-transactions.patch
File django-terminate-isolating-transactions.patch, 2.2 KB (added by , 14 years ago) |
---|
-
django/db/backends/__init__.py
50 50 """ 51 51 pass 52 52 53 def _terminate_transaction_isolation(self, commited): 54 """ 55 A hook for backend-specific changes required to reset the transaction 56 isolation level. 57 """ 58 pass 59 53 60 def _savepoint(self, sid): 54 61 if not self.features.uses_savepoints: 55 62 return -
django/db/backends/postgresql_psycopg2/base.py
176 176 if self.features.uses_autocommit and not managed and self.isolation_level: 177 177 self._set_isolation_level(0) 178 178 179 def _terminate_transaction_isolation(self, commited): 180 """ 181 The transaction is over so if the isolation level is not zero, 182 terminate the isolating transaction. 183 """ 184 if self.isolation_level and self.connection.get_transaction_status() == \ 185 psycopg2.extensions.TRANSACTION_STATUS_INTRANS: 186 if commited: 187 self.connection.commit() 188 else: 189 self.connection.rollback() 190 179 191 def _set_isolation_level(self, level): 180 192 """ 181 193 Do all the related feature configurations for changing isolation -
django/db/transaction.py
84 84 raise TransactionManagementError("This code isn't under transaction management") 85 85 if dirty.get(thread_ident, {}).get(using, False): 86 86 rollback(using=using) 87 connection._terminate_transaction_isolation(False) 87 88 raise TransactionManagementError("Transaction managed block ended with pending COMMIT/ROLLBACK") 89 else: 90 connection._terminate_transaction_isolation(True) 88 91 dirty[thread_ident][using] = False 89 92 90 93 def is_dirty(using=None):