#24776: apps.get_app_config does not handle fully-qualified package names
-------------------------------+--------------------
Reporter: inglesp | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Running eg `./manage.py dumpdata django.contrib.auth` fails with
`CommandError: Unknown application: django.contrib.auth`. Instead, you
need to call the command with just `auth`.
This is because it calls through to `apps.get_app_config` which does not
expect a fully-qualified package name.
There is a similar problem with other management commands that take an
app's name.
There are a handful of approaches to fixing this:
1. `apps.get_app_config` should split a package name on dots, throw away
all but the last token, and use this for looking up the app. I've not
thought through all the consequences of this -- could an app name
legitimately contain dots?
2. As for 1, but only if the package name begins `django.contrib`.
3. When `apps.get_app_config` raises a `LookupError`, it could check to
see whether its argument contains dots, and its message could be something
like `No installed app with label 'x.y.z'. Did you mean 'z'?`.
4. Whenever a management command calls `apps.get_app_config`, it could
strip off `django.contrib.` if present.
I'm happy to code up a fix if/when the right approach is settle on.
--
Ticket URL: <https://code.djangoproject.com/ticket/24776>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.261053cf4961a7aae4b1da818aefe112%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.