On 06/01/14 00:26, Aymeric Augustin wrote:
> On 5 janv. 2014, at 22:54, Shai Berger <s...@platonix.com> wrote:
> 
>> I'd go for __contains__: 
>>
>>      if "django.contrib.auth" in apps:
> 
> I considered this one but I didn’t select it because it will restrict our 
> freedom in the future.
> 
> If I were to add magic methods on the app registry I’d probably make it a 
> dict of app_label => app_config. This is the most common use case.
> 
> Then it would be inconsistent to support `if "django.contrib.auth" in apps` 
> and `apps['admin']` at the same time.
> 

+1 for is_installed.

And I like your plan to make apps behave as a dict of app_label =>
AppConfig instances. When you want to test for a full app name, use

  if apps.is_installed('django.contrib.admin'): ...

If you don't care about the full path and want to test for the
app_label, then use

  if "admin" in apps: ...

Aymeric, you are really talented! Thanks for your work!
Luc

-- 
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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/52CA1044.9010708%40gmx.net.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to