#32177: ManagementUtility instantiates CommandParser without passing already-
computed prog argument
-------------------------------------+-------------------------------------
Reporter: William Schwartz | Owner: William
| Schwartz
Type: Bug | Status: closed
Component: Core (Management | Version: dev
commands) |
Severity: Normal | Resolution: fixed
Keywords: freezers | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by niklasmohrin):
I believe the same problem exists with the `CommandParser` used by
subcommands: At the end of `ManagementUtility.execute` (see 1), the
subcommand is run with
`self.fetch_command(subcommand).run_from_argv(self.argv)`. In
`run_from_argv`, a parser is created with `self.argv[0]` via `parser =
self.create_parser(argv[0], argv[1])` (see 2). Thus, when running `python
-m django check --help` (or any other subcommand), the output starts with
`usage: __main__.py check`.
Maybe it would be better to just update `self.argv[0]` in
`ManagementUtility` instead of having `prog_name`?
Either way, should I open a separate ticket and/or implement the proposed
change?
- (1):
https://github.com/django/django/blob/4a3ad9eebbc16ce80b348644b557c84ecc741be7/django/core/management/__init__.py#L436
- (2):
https://github.com/django/django/blob/4a3ad9eebbc16ce80b348644b557c84ecc741be7/django/core/management/base.py#L408
--
Ticket URL: <https://code.djangoproject.com/ticket/32177#comment:8>
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 view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070194f1860f99-3b776cb6-5c24-4875-86ad-066cc3973a84-000000%40eu-central-1.amazonses.com.