Fixed #19257 -- Don't swallow command's KeyError in call_command
Thanks Giovanni Bajo for the report.
This commit is contained in:
parent
e8f696097b
commit
9a09558e9f
|
@ -136,13 +136,14 @@ def call_command(name, *args, **options):
|
||||||
# Load the command object.
|
# Load the command object.
|
||||||
try:
|
try:
|
||||||
app_name = get_commands()[name]
|
app_name = get_commands()[name]
|
||||||
|
except KeyError:
|
||||||
|
raise CommandError("Unknown command: %r" % name)
|
||||||
|
|
||||||
if isinstance(app_name, BaseCommand):
|
if isinstance(app_name, BaseCommand):
|
||||||
# If the command is already loaded, use it directly.
|
# If the command is already loaded, use it directly.
|
||||||
klass = app_name
|
klass = app_name
|
||||||
else:
|
else:
|
||||||
klass = load_command_class(app_name, name)
|
klass = load_command_class(app_name, name)
|
||||||
except KeyError:
|
|
||||||
raise CommandError("Unknown command: %r" % name)
|
|
||||||
|
|
||||||
# Grab out a list of defaults from the options. optparse does this for us
|
# Grab out a list of defaults from the options. optparse does this for us
|
||||||
# when the script runs from the command line, but since call_command can
|
# when the script runs from the command line, but since call_command can
|
||||||
|
|
Loading…
Reference in New Issue