If you need a variable to say the same thing as an isinstance check, that
just seems like a mess to me. It's not like we're duck typing based on the
attributes we'll actually use.


On Fri, Dec 20, 2013 at 9:20 PM, Daniel Lindsley
<notifications@github.com>wrote:

> In django/core/apps/base.py:
>
> > -    def _stub(cls, label):
> > -        return cls(label, None, None)
> > +    def create(cls, entry):
> > +        """
> > +        Factory that creates an app config from an entry in INSTALLED_APPS.
> > +        """
> > +        try:
> > +            # Entry is a path to an app module.
> > +            app_module = import_module(entry)
> > +            app_config_cls = getattr(app_module, 'AppConfig', cls)
> > +            app_name = entry
> > +        except ImportError:
> > +            # Entry is a path to an AppConfig subclass.
> > +            app_config_cls = import_by_path(entry)
> > +            # Check for obvious errors (at the cost of duck typing).
> > +            if not issubclass(app_config_cls, AppConfig):
>
> Could we set a class variable on the AppConfig class instead, something
> like is_app_config = True? Then we can duck it, just checking to see
> that's present.
>
> Perhaps it's just me, but I've been bitten by isinstance/issubclass too
> many times, especially when people vendor code or when there's a genuine
> reason to have a different base class. OTOH, that may be overkill here.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/django/django/pull/2089/files#r8516476>
> .
>



-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084