mirror of
https://github.com/django/django.git
synced 2025-10-27 07:36:08 +00:00
Avoided leaking state on exceptions in populate_models().
This commit is contained in:
@@ -125,11 +125,12 @@ class Apps(object):
|
|||||||
self._postponed.append(app_config)
|
self._postponed.append(app_config)
|
||||||
|
|
||||||
if outermost:
|
if outermost:
|
||||||
for app_config in self._postponed:
|
try:
|
||||||
all_models = self.all_models[app_config.label]
|
for app_config in self._postponed:
|
||||||
app_config.import_models(all_models)
|
all_models = self.all_models[app_config.label]
|
||||||
|
app_config.import_models(all_models)
|
||||||
del self._postponed
|
finally:
|
||||||
|
del self._postponed
|
||||||
|
|
||||||
self.clear_cache()
|
self.clear_cache()
|
||||||
self._models_loaded = True
|
self._models_loaded = True
|
||||||
|
|||||||
Reference in New Issue
Block a user