From 972babc3b45971a69a6b2a49fc498d92db674cae Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Wed, 18 Dec 2013 13:10:23 +0100 Subject: [PATCH] Removed the only_installed argument of get_app_config[s]. It wasn't used anywhere and couldn't be implemented any more since non-installed apps no longer have a configuration. --- django/core/apps/cache.py | 20 +++----------------- tests/admin_scripts/tests.py | 16 ++++++++-------- 2 files changed, 11 insertions(+), 25 deletions(-) diff --git a/django/core/apps/cache.py b/django/core/apps/cache.py index deffc84586..69f2f2c974 100644 --- a/django/core/apps/cache.py +++ b/django/core/apps/cache.py @@ -136,29 +136,22 @@ class AppCache(object): """ return self.loaded - def get_app_configs(self, only_installed=True, only_with_models_module=False): + def get_app_configs(self, only_with_models_module=False): """ Return an iterable of application configurations. - If only_installed is True (default), only applications explicitly - listed in INSTALLED_APPS are considered. - If only_with_models_module in True (non-default), only applications containing a models module are considered. """ - if not only_installed: - raise ValueError("only_installed=False isn't supported any more.") self.populate() for app_config in self.app_configs.values(): - if only_installed and not app_config.installed: - continue if only_with_models_module and app_config.models_module is None: continue if self.available_apps is not None and app_config.name not in self.available_apps: continue yield app_config - def get_app_config(self, app_label, only_installed=True, only_with_models_module=False): + def get_app_config(self, app_label, only_with_models_module=False): """ Returns the application configuration for the given app_label. @@ -167,20 +160,13 @@ class AppCache(object): Raises UnavailableApp when set_available_apps() disables the application with this app_label. - If only_installed is True (default), only applications explicitly - listed in INSTALLED_APPS are considered. - If only_with_models_module in True (non-default), only applications containing a models module are considered. """ - if not only_installed: - raise ValueError("only_installed=False isn't supported any more.") self.populate() app_config = self.app_configs.get(app_label) if app_config is None: - raise LookupError("No app with label %r." % app_label) - if only_installed and not app_config.installed: - raise LookupError("App with label %r isn't in INSTALLED_APPS." % app_label) + raise LookupError("No installed app with label %r." % app_label) if only_with_models_module and app_config.models_module is None: raise LookupError("App with label %r doesn't have a models module." % app_label) if self.available_apps is not None and app_config.name not in self.available_apps: diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py index 8f693bfd34..db0b8d6030 100644 --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -379,14 +379,14 @@ class DjangoAdminMinimalSettings(AdminScriptTestCase): args = ['sqlall', '--settings=test_project.settings', 'admin_scripts'] out, err = self.run_django_admin(args) self.assertNoOutput(out) - self.assertOutput(err, "No app with label 'admin_scripts'.") + self.assertOutput(err, "No installed app with label 'admin_scripts'.") def test_builtin_with_environment(self): "minimal: django-admin builtin commands fail if settings are provided in the environment" args = ['sqlall', 'admin_scripts'] out, err = self.run_django_admin(args, 'test_project.settings') self.assertNoOutput(out) - self.assertOutput(err, "No app with label 'admin_scripts'.") + self.assertOutput(err, "No installed app with label 'admin_scripts'.") def test_builtin_with_bad_settings(self): "minimal: django-admin builtin commands fail if settings file (from argument) doesn't exist" @@ -815,21 +815,21 @@ class ManageMinimalSettings(AdminScriptTestCase): args = ['sqlall', 'admin_scripts'] out, err = self.run_manage(args) self.assertNoOutput(out) - self.assertOutput(err, "No app with label 'admin_scripts'.") + self.assertOutput(err, "No installed app with label 'admin_scripts'.") def test_builtin_with_settings(self): "minimal: manage.py builtin commands fail if settings are provided as argument" args = ['sqlall', '--settings=test_project.settings', 'admin_scripts'] out, err = self.run_manage(args) self.assertNoOutput(out) - self.assertOutput(err, "No app with label 'admin_scripts'.") + self.assertOutput(err, "No installed app with label 'admin_scripts'.") def test_builtin_with_environment(self): "minimal: manage.py builtin commands fail if settings are provided in the environment" args = ['sqlall', 'admin_scripts'] out, err = self.run_manage(args, 'test_project.settings') self.assertNoOutput(out) - self.assertOutput(err, "No app with label 'admin_scripts'.") + self.assertOutput(err, "No installed app with label 'admin_scripts'.") def test_builtin_with_bad_settings(self): "minimal: manage.py builtin commands fail if settings file (from argument) doesn't exist" @@ -964,7 +964,7 @@ class ManageMultipleSettings(AdminScriptTestCase): args = ['sqlall', 'admin_scripts'] out, err = self.run_manage(args) self.assertNoOutput(out) - self.assertOutput(err, "No app with label 'admin_scripts'.") + self.assertOutput(err, "No installed app with label 'admin_scripts'.") def test_builtin_with_settings(self): "multiple: manage.py builtin commands succeed if settings are provided as argument" @@ -1442,13 +1442,13 @@ class CommandTypes(AdminScriptTestCase): "User AppCommands can execute when a single app name is provided" args = ['app_command', 'NOT_AN_APP'] out, err = self.run_manage(args) - self.assertOutput(err, "No app with label 'NOT_AN_APP'.") + self.assertOutput(err, "No installed app with label 'NOT_AN_APP'.") def test_app_command_some_invalid_appnames(self): "User AppCommands can execute when some of the provided app names are invalid" args = ['app_command', 'auth', 'NOT_AN_APP'] out, err = self.run_manage(args) - self.assertOutput(err, "No app with label 'NOT_AN_APP'.") + self.assertOutput(err, "No installed app with label 'NOT_AN_APP'.") def test_label_command(self): "User LabelCommands can execute when a label is provided"