Hello,

During the app_loading refactor, I introduced a method to test if a given 
application is enabled, and I named it `has_app`.

Its main uses are detecting misconfigurations:

        if not apps.has_app('django.contrib.admin'):
            raise ImproperlyConfigured("Put 'django.contrib.admin' in your "
                "INSTALLED_APPS setting in order to use the admin application.")

and skipping tests:

     @skipUnless(apps.has_app('django.contrib.sites'),
                 "django.contrib.sites app not installed.")

That method takes an application name like “django.contrib.admin” rather than a 
label for two reasons: name conflicts are less likely than label conflicts (but 
they’re still possible) and unlike labels names cannot be changed.

`apps.has_app(...)` is technically correct but I think we can find a better 
name. My current favorite is `apps.installed(…)`. It’s quite short and it’s 
reminiscent of INSTALLED_APPS. That makes (some) sense since the method tests 
if its argument is in INSTALLED_APPS, accounting for AppConfigs.

Since I’m awful at picking names, I’d like to hear your suggestions and 
arguments before making a decision.

Thank you,

-- 
Aymeric.



-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/4DDB6F03-811A-4381-9D0F-CB1BD9773CA7%40polytechnique.org.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to