Skip to content

Commit

Permalink
Fixed #21718 -- Renamed has_app to is_installed.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Jan 6, 2014
1 parent b57c48d commit 6a320cc
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion django/apps/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def register_model(self, app_label, model):
app_models[model_name] = model
self.clear_cache()

def has_app(self, app_name):
def is_installed(self, app_name):
"""
Checks whether an application with this name exists in the registry.
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/admin/sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ def check_dependencies(self):
The default implementation checks that admin and contenttypes apps are
installed, as well as the auth context processor.
"""
if not apps.has_app('django.contrib.admin'):
if not apps.is_installed('django.contrib.admin'):
raise ImproperlyConfigured("Put 'django.contrib.admin' in your "
"INSTALLED_APPS setting in order to use the admin application.")
if not apps.has_app('django.contrib.contenttypes'):
if not apps.is_installed('django.contrib.contenttypes'):
raise ImproperlyConfigured("Put 'django.contrib.contenttypes' in "
"your INSTALLED_APPS setting in order to use the admin application.")
if 'django.contrib.auth.context_processors.auth' not in settings.TEMPLATE_CONTEXT_PROCESSORS:
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/admin/templatetags/admin_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

register = Library()

if apps.has_app('django.contrib.staticfiles'):
if apps.is_installed('django.contrib.staticfiles'):
from django.contrib.staticfiles.templatetags.staticfiles import static
else:
from django.templatetags.static import static
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/messages/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

def skipUnlessAuthIsInstalled(func):
return skipUnless(
apps.has_app('django.contrib.auth'),
apps.is_installed('django.contrib.auth'),
"django.contrib.auth isn't installed")(func)


Expand Down
2 changes: 1 addition & 1 deletion django/contrib/redirects/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class RedirectFallbackMiddleware(object):
response_redirect_class = http.HttpResponsePermanentRedirect

def __init__(self):
if not apps.has_app('django.contrib.sites'):
if not apps.is_installed('django.contrib.sites'):
raise ImproperlyConfigured(
"You cannot use RedirectFallbackMiddleware when "
"django.contrib.sites is not installed."
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/sitemaps/tests/test_flatpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

class FlatpagesSitemapTests(SitemapTestsBase):

@skipUnless(apps.has_app('django.contrib.flatpages'),
@skipUnless(apps.is_installed('django.contrib.flatpages'),
"django.contrib.flatpages app not installed.")
def test_flatpage_sitemap(self):
"Basic FlatPage sitemap test"
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/sitemaps/tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_requestsite_sitemap(self):
""" % date.today()
self.assertXMLEqual(response.content.decode('utf-8'), expected_content)

@skipUnless(apps.has_app('django.contrib.sites'),
@skipUnless(apps.is_installed('django.contrib.sites'),
"django.contrib.sites app not installed.")
def test_sitemap_get_urls_no_site_1(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions django/test/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def _session(self):
"""
Obtains the current session variables.
"""
if apps.has_app('django.contrib.sessions'):
if apps.is_installed('django.contrib.sessions'):
engine = import_module(settings.SESSION_ENGINE)
cookie = self.cookies.get(settings.SESSION_COOKIE_NAME, None)
if cookie:
Expand Down Expand Up @@ -551,7 +551,7 @@ def login(self, **credentials):
"""
user = authenticate(**credentials)
if (user and user.is_active and
apps.has_app('django.contrib.sessions')):
apps.is_installed('django.contrib.sessions')):
engine = import_module(settings.SESSION_ENGINE)

# Create a fake request that goes through request middleware
Expand Down
2 changes: 1 addition & 1 deletion docs/ref/applications.txt
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ Application registry
given ``app_label``. Raises :exc:`~exceptions.LookupError` if no such
application exists.

.. method:: apps.has_app(app_name)
.. method:: apps.is_installed(app_name)

Checks whether an application with the given name exists in the registry.
``app_name`` is the full name of the app, e.g. 'django.contrib.admin'.
Expand Down
8 changes: 4 additions & 4 deletions tests/apps/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ def test_get_app_config(self):
apps.get_app_config('webdesign')

@override_settings(INSTALLED_APPS=SOME_INSTALLED_APPS)
def test_has_app(self):
self.assertTrue(apps.has_app('django.contrib.admin'))
self.assertTrue(apps.has_app('django.contrib.staticfiles'))
self.assertFalse(apps.has_app('django.contrib.webdesign'))
def test_is_installed(self):
self.assertTrue(apps.is_installed('django.contrib.admin'))
self.assertTrue(apps.is_installed('django.contrib.staticfiles'))
self.assertFalse(apps.is_installed('django.contrib.webdesign'))

@override_settings(INSTALLED_APPS=['apps.apps.RelabeledAppsConfig'])
def test_relabeling(self):
Expand Down

0 comments on commit 6a320cc

Please sign in to comment.