Commit fec5330c authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

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.
parent 8925aaf6
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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 ###