1
0
mirror of https://github.com/django/django.git synced 2024-12-25 02:26:12 +00:00

Avoided leaking state on exceptions in populate_models().

This commit is contained in:
Aymeric Augustin 2013-12-30 17:00:50 +01:00
parent e5c89c62f2
commit d6dc88cbc1

View File

@ -125,11 +125,12 @@ class Apps(object):
self._postponed.append(app_config)
if outermost:
for app_config in self._postponed:
all_models = self.all_models[app_config.label]
app_config.import_models(all_models)
del self._postponed
try:
for app_config in self._postponed:
all_models = self.all_models[app_config.label]
app_config.import_models(all_models)
finally:
del self._postponed
self.clear_cache()
self._models_loaded = True