Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoided leaking state on exceptions in populate_models().

  • Loading branch information...
commit d6dc88cbc1ebc4cfba6faf39edf6eebd41873029 1 parent e5c89c6
Aymeric Augustin aaugustin authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 django/apps/registry.py
11 django/apps/registry.py
View
@@ -125,11 +125,12 @@ def populate_models(self):
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
Please sign in to comment.
Something went wrong with that request. Please try again.