Commit 0f956085 authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

Removed legacy transaction management per the deprecation timeline.

parent 907ac646
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -500,7 +500,7 @@ def create_generic_related_manager(superclass):
            if bulk:
                queryset.delete()
            else:
                with transaction.commit_on_success_unless_managed(using=db, savepoint=False):
                with transaction.atomic(using=db, savepoint=False):
                    for obj in queryset:
                        obj.delete()
        _clear.alters_data = True
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ class Command(BaseCommand):
        for i, line in enumerate(table_output):
            full_statement.append('    %s%s' % (line, ',' if i < len(table_output) - 1 else ''))
        full_statement.append(');')
        with transaction.commit_on_success_unless_managed():
        with transaction.atomic():
            with connection.cursor() as curs:
                try:
                    curs.execute("\n".join(full_statement))
+1 −1
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ Are you sure you want to do this?

        if confirm == 'yes':
            try:
                with transaction.commit_on_success_unless_managed():
                with transaction.atomic():
                    with connection.cursor() as cursor:
                        for sql in sql_list:
                            cursor.execute(sql)
+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ class Command(BaseCommand):

        self.verbosity = int(options.get('verbosity'))

        with transaction.commit_on_success_unless_managed(using=self.using):
        with transaction.atomic(using=self.using):
            self.loaddata(fixture_labels)

        # Close the DB connection -- unless we're still in a transaction. This
+2 −6
Original line number Diff line number Diff line
@@ -223,10 +223,6 @@ class Command(BaseCommand):
                        for statement in sql:
                            cursor.execute(statement)
                        tables.append(connection.introspection.table_name_converter(model._meta.db_table))

            # We force a commit here, as that was the previous behavior.
            # If you can prove we don't need this, remove it.
            transaction.set_dirty(using=connection.alias)
        finally:
            cursor.close()

@@ -245,7 +241,7 @@ class Command(BaseCommand):
                            if self.verbosity >= 2:
                                self.stdout.write("    Installing custom SQL for %s.%s model\n" % (app_name, model._meta.object_name))
                            try:
                                with transaction.commit_on_success_unless_managed(using=connection.alias):
                                with transaction.atomic(using=connection.alias):
                                    for sql in custom_sql:
                                        cursor.execute(sql)
                            except Exception as e:
@@ -268,7 +264,7 @@ class Command(BaseCommand):
                            if self.verbosity >= 2:
                                self.stdout.write("    Installing index for %s.%s model\n" % (app_name, model._meta.object_name))
                            try:
                                with transaction.commit_on_success_unless_managed(using=connection.alias):
                                with transaction.atomic(using=connection.alias):
                                    for sql in index_sql:
                                        cursor.execute(sql)
                            except Exception as e:
Loading