From fec5330c7937efe30294d060a57af6400ce073a9 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Thu, 26 Dec 2013 18:37:04 +0100 Subject: [PATCH] Made unset_installed_apps reset the app registry state. Previously the _apps/models_loaded flags could remain set to False if set_installed_apps exited with an exception, which is going to happen as soon as we add tests for invalid values of INSTALLED_APPS. --- django/apps/registry.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/apps/registry.py b/django/apps/registry.py index e39fb43fa4..737fc960b8 100644 --- a/django/apps/registry.py +++ b/django/apps/registry.py @@ -346,7 +346,7 @@ class Apps(object): imports safely (eg. that could lead to registering listeners twice), models are registered when they're imported and never removed. """ - self.stored_app_configs.append(self.app_configs) + self.stored_app_configs.append((self.app_configs, self._apps_loaded, self._models_loaded)) self.app_configs = OrderedDict() self.get_models.cache_clear() self._apps_loaded = False @@ -358,7 +358,7 @@ class Apps(object): """ Cancels a previous call to set_installed_apps(). """ - self.app_configs = self.stored_app_configs.pop() + self.app_configs, self._apps_loaded, self._models_loaded = self.stored_app_configs.pop() self.get_models.cache_clear() ### DEPRECATED METHODS GO BELOW THIS LINE ###