diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-21 10:38:44 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-04-21 10:38:44 +0200 |
commit | 3f2c37a22611c7585d9eea2f87b258fb045a38b8 (patch) | |
tree | d84402beef23594c3e9c0ee468eef2fa9171a18c /ishtar_common | |
parent | b8c71bb519ce212ba6e5d33666bf1330cda1b744 (diff) | |
download | Ishtar-3f2c37a22611c7585d9eea2f87b258fb045a38b8.tar.bz2 Ishtar-3f2c37a22611c7585d9eea2f87b258fb045a38b8.zip |
commit_on_success -> atomic
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/data_importer.py | 8 |
1 files changed, 4 insertions, 4 deletions
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 <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2013-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # 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: |