From f25fa9d8590c7759c1ec7ffecf1d67be81237674 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Wed, 18 Dec 2013 17:56:11 +0100 Subject: Deprecated load_app(). Adjusted several tests that used it to add apps to the app cache and then attempted to remove them by manipulating attributes directly. Also renamed invalid_models to invalid_models_tests to avoid clashing application labels between the outer and the inner invalid_models applications. --- django/core/apps/cache.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'django') diff --git a/django/core/apps/cache.py b/django/core/apps/cache.py index 74488325a8..65f51801ec 100644 --- a/django/core/apps/cache.py +++ b/django/core/apps/cache.py @@ -133,16 +133,6 @@ class AppCache(object): self._models_loaded = True - def load_app(self, app_name): - """ - Loads the app with the provided fully qualified name, and returns the - model module. - """ - app_config = AppConfig(app_name) - app_config.import_models(self.all_models[app_config.label]) - self.app_configs[app_config.label] = app_config - return app_config.models_module - def app_cache_ready(self): """ Returns true if the model cache is fully populated. @@ -377,6 +367,19 @@ class AppCache(object): ### DEPRECATED METHODS GO BELOW THIS LINE ### + def load_app(self, app_name): + """ + Loads the app with the provided fully qualified name, and returns the + model module. + """ + warnings.warn( + "load_app(app_name) is deprecated.", + PendingDeprecationWarning, stacklevel=2) + app_config = AppConfig(app_name) + app_config.import_models(self.all_models[app_config.label]) + self.app_configs[app_config.label] = app_config + return app_config.models_module + def get_app(self, app_label): """ Returns the module containing the models for the given app_label. @@ -447,7 +450,7 @@ class AppCache(object): Register a set of models as belonging to an app. """ warnings.warn( - "register_models(app_label, models) is deprecated.", + "register_models(app_label, *models) is deprecated.", PendingDeprecationWarning, stacklevel=2) for model in models: self.register_model(app_label, model) -- cgit v1.3