From 7b4815b455fc99a2661492f91f7242cfb09a7017 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Thu, 7 Mar 2013 11:50:49 +0100 Subject: [PATCH] Expressed the dirty flag handling logic in terms of autocommit. --- django/db/backends/__init__.py | 3 ++- django/db/backends/postgresql_psycopg2/base.py | 4 ---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/django/db/backends/__init__.py b/django/db/backends/__init__.py index ada0e038b4..d372384fc5 100644 --- a/django/db/backends/__init__.py +++ b/django/db/backends/__init__.py @@ -311,7 +311,8 @@ class BaseDatabaseWrapper(object): to decide in a managed block of code to decide whether there are open changes waiting for commit. """ - self._dirty = True + if not self.autocommit: + self._dirty = True def set_clean(self): """ diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index 385206221d..cc1d1ae567 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -202,10 +202,6 @@ class DatabaseWrapper(BaseDatabaseWrapper): level = self.isolation_level self.connection.set_isolation_level(level) - def set_dirty(self): - if self.transaction_state and self.transaction_state[-1]: - super(DatabaseWrapper, self).set_dirty() - def check_constraints(self, table_names=None): """ To check constraints, we set constraints to immediate. Then, when, we're done we must ensure they