diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index 078fd6f..9a827a6 100644
a
|
b
|
class Command(BaseCommand):
|
193 | 193 | loaded_object_count += loaded_objects_in_fixture |
194 | 194 | fixture_object_count += objects_in_fixture |
195 | 195 | label_found = True |
| 196 | except Exception as e: |
| 197 | if not isinstance(e, CommandError): |
| 198 | e.args = ("Problem installing fixture '%s': %s" % (full_path, e),) |
| 199 | raise |
196 | 200 | finally: |
197 | 201 | fixture.close() |
198 | 202 | |
… |
… |
class Command(BaseCommand):
|
206 | 210 | # Since we disabled constraint checks, we must manually check for |
207 | 211 | # any invalid keys that might have been added |
208 | 212 | table_names = [model._meta.db_table for model in models] |
209 | | connection.check_constraints(table_names=table_names) |
| 213 | try: |
| 214 | connection.check_constraints(table_names=table_names) |
| 215 | except Exception as e: |
| 216 | e.args = ("Problem installing fixtures: %s" % e,) |
| 217 | raise |
210 | 218 | |
211 | 219 | except (SystemExit, KeyboardInterrupt): |
212 | 220 | raise |
… |
… |
class Command(BaseCommand):
|
214 | 222 | if commit: |
215 | 223 | transaction.rollback(using=using) |
216 | 224 | transaction.leave_transaction_management(using=using) |
217 | | if not isinstance(e, CommandError): |
218 | | e.args = ("Problem installing fixture '%s': %s" % (full_path, e),) |
219 | 225 | raise |
220 | 226 | |
221 | 227 | # 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 81808df..3766fae 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):
|
43 | 42 | |
44 | 43 | |
45 | 44 | @receiver(setting_changed) |
46 | | def clear_context_processors_cache(**kwargs): |
| 45 | def clear_global_variables(**kwargs): |
47 | 46 | if kwargs['setting'] == 'TEMPLATE_CONTEXT_PROCESSORS': |
| 47 | from django.template import context |
48 | 48 | context._standard_context_processors = None |
| 49 | elif kwargs['setting'] == 'SERIALIZATION_MODULES': |
| 50 | from django.core import serializers |
| 51 | serializers._serializers = {} |
diff --git a/tests/regressiontests/fixtures_regress/tests.py b/tests/regressiontests/fixtures_regress/tests.py
index c0b811b..1bba237 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 |