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 | |
parent | b8c71bb519ce212ba6e5d33666bf1330cda1b744 (diff) | |
download | Ishtar-3f2c37a22611c7585d9eea2f87b258fb045a38b8.tar.bz2 Ishtar-3f2c37a22611c7585d9eea2f87b258fb045a38b8.zip |
commit_on_success -> atomic
-rw-r--r-- | archaeological_operations/tests.py | 2 | ||||
-rw-r--r-- | example_project/settings.py | 1 | ||||
-rw-r--r-- | ishtar_common/data_importer.py | 8 |
3 files changed, 6 insertions, 5 deletions
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py index 183a2f682..303ed2237 100644 --- a/archaeological_operations/tests.py +++ b/archaeological_operations/tests.py @@ -1266,7 +1266,7 @@ class OperationWizardDeleteTest(OperationWizardCreationTest): ] def pass_test(self): - if not settings.SOUTH_TESTS_MIGRATE: + if not settings.TEST_VIEWS: # with no migration the views are not created return True diff --git a/example_project/settings.py b/example_project/settings.py index 9d0b02299..8241e3fca 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -11,6 +11,7 @@ TEMPLATE_DEBUG = DEBUG SQL_DEBUG = False DJANGO_EXTENSIONS = False USE_SPATIALITE_FOR_TESTS = True +TEST_VIEWS = True if "test" in sys.argv: sys.path.insert(0, '..') 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: |