diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index 34f8041..f42dfb0 100644
a
|
b
|
class Command(BaseCommand):
|
196 | 196 | loaded_object_count += loaded_objects_in_fixture |
197 | 197 | fixture_object_count += objects_in_fixture |
198 | 198 | label_found = True |
| 199 | except Exception as e: |
| 200 | if not isinstance(e, CommandError): |
| 201 | e.args = ("Problem installing fixture '%s': %s" % (full_path, e),) |
| 202 | raise |
199 | 203 | finally: |
200 | 204 | fixture.close() |
201 | 205 | |
… |
… |
class Command(BaseCommand):
|
209 | 213 | # Since we disabled constraint checks, we must manually check for |
210 | 214 | # any invalid keys that might have been added |
211 | 215 | table_names = [model._meta.db_table for model in models] |
212 | | connection.check_constraints(table_names=table_names) |
| 216 | try: |
| 217 | connection.check_constraints(table_names=table_names) |
| 218 | except Exception as e: |
| 219 | e.args = ("Problem installing fixtures: %s" % e,) |
| 220 | raise |
213 | 221 | |
214 | 222 | except (SystemExit, KeyboardInterrupt): |
215 | 223 | raise |
… |
… |
class Command(BaseCommand):
|
217 | 225 | if commit: |
218 | 226 | transaction.rollback(using=using) |
219 | 227 | transaction.leave_transaction_management(using=using) |
220 | | if not isinstance(e, CommandError): |
221 | | e.args = ("Problem installing fixture '%s': %s" % (full_path, e),) |
222 | 228 | raise |
223 | 229 | |
224 | 230 | # If we found even one object in a fixture, we need to reset the |
diff --git a/django/test/signals.py b/django/test/signals.py
index 052b7df..5b0a9a1 100644
a
|
b
|
import time
|
4 | 4 | from django.conf import settings |
5 | 5 | from django.db import connections |
6 | 6 | from django.dispatch import receiver, Signal |
7 | | from django.template import context |
8 | 7 | from django.utils import timezone |
9 | 8 | |
10 | 9 | template_rendered = Signal(providing_args=["template", "context"]) |
… |
… |
def update_connections_time_zone(**kwargs):
|
48 | 47 | @receiver(setting_changed) |
49 | 48 | def clear_context_processors_cache(**kwargs): |
50 | 49 | if kwargs['setting'] == 'TEMPLATE_CONTEXT_PROCESSORS': |
| 50 | from django.template import context |
51 | 51 | context._standard_context_processors = None |
52 | 52 | |
53 | 53 | |
54 | 54 | @receiver(setting_changed) |
| 55 | def clear_serializers_cache(**kwargs): |
| 56 | if kwargs['setting'] == 'SERIALIZATION_MODULES': |
| 57 | from django.core import serializers |
| 58 | serializers._serializers = {} |
| 59 | |
| 60 | |
| 61 | @receiver(setting_changed) |
55 | 62 | def language_changed(**kwargs): |
56 | 63 | if kwargs['setting'] in ('LOCALE_PATHS', 'LANGUAGE_CODE'): |
57 | 64 | from django.utils.translation import trans_real |
diff --git a/tests/regressiontests/fixtures_regress/tests.py b/tests/regressiontests/fixtures_regress/tests.py
index ab93341..7ffb2af 100644
a
|
b
|
class TestFixtures(TestCase):
|
126 | 126 | commit=False, |
127 | 127 | ) |
128 | 128 | |
| 129 | @override_settings(SERIALIZATION_MODULES={'unkn': 'unexistent.path'}) |
| 130 | def test_unimportable_serializer(self): |
| 131 | """ |
| 132 | Test that failing serializer import raises the proper error |
| 133 | """ |
| 134 | with self.assertRaisesRegexp(ImportError, |
| 135 | "No module named unexistent.path"): |
| 136 | management.call_command( |
| 137 | 'loaddata', |
| 138 | 'bad_fixture1.unkn', |
| 139 | verbosity=0, |
| 140 | commit=False, |
| 141 | ) |
| 142 | |
129 | 143 | def test_invalid_data(self): |
130 | 144 | """ |
131 | 145 | Test for ticket #4371 -- Loading a fixture file with invalid data |