From 172dd2d8a4d462a7fcebcbc4accb704f2a9afda5 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 21 Apr 2017 10:38:44 +0200 Subject: commit_on_success -> atomic --- ishtar_common/data_importer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ishtar_common/data_importer.py') diff --git a/ishtar_common/data_importer.py b/ishtar_common/data_importer.py index 10957e74d..65cd83c12 100644 --- a/ishtar_common/data_importer.py +++ b/ishtar_common/data_importer.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2013-2015 Étienne Loks +# Copyright (C) 2013-2017 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -342,7 +342,7 @@ class StrChoiceFormater(Formater, ChoiceChecker): if hasattr(value, 'pk'): value = value.pk q['value'] = value - with transaction.commit_on_success(): + with transaction.atomic(): try: t, created = TargetKey.objects.get_or_create(**q) except IntegrityError: @@ -404,7 +404,7 @@ class StrChoiceFormater(Formater, ChoiceChecker): target.is_set = True target.save() else: - with transaction.commit_on_success(): + with transaction.atomic(): q['value'] = self.equiv_dict[value] q['is_set'] = True try: @@ -418,7 +418,7 @@ class StrChoiceFormater(Formater, ChoiceChecker): 'associated_import': import_instance} if TargetKey.objects.filter(**q).count(): continue - with transaction.commit_on_success(): + with transaction.atomic(): try: TargetKey.objects.create(**q) except IntegrityError: -- cgit v1.2.3