From 4f064c2f0511dc900c7f4a736573c309de84dec7 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sun, 22 Dec 2013 17:07:18 +0100 Subject: [PATCH] Changed has_app to return a boolean. That matches its name ad its purpose better. --- django/apps/cache.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django/apps/cache.py b/django/apps/cache.py index 056aa9a60b..e7adffecdb 100644 --- a/django/apps/cache.py +++ b/django/apps/cache.py @@ -300,15 +300,15 @@ class AppCache(object): def has_app(self, app_name): """ - Returns the application config if one is registered and None otherwise. + Checks whether an application with this name exists in the app cache. + + app_name is the full name of the app eg. 'django.contrib.admin'. It's safe to call this method at import time, even while the app cache is being populated. It returns None for apps that aren't loaded yet. """ app_config = self.app_configs.get(app_name.rpartition(".")[2]) - if app_config is not None and app_config.name != app_name: - app_config = None - return app_config + return app_config is not None and app_config.name == app_name: def has_model(self, app_label, model_name): """