Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.5.x] Fixed #19257 -- Don't swallow command's KeyError in call_command

Thanks Giovanni Bajo for the report.
Backport of 9a09558 from master.
  • Loading branch information...
commit 34d0c30e877739c8a7354ecd878f2ffe9e7c613f 1 parent 5b19073
@claudep claudep authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 django/core/management/__init__.py
View
11 django/core/management/__init__.py
@@ -136,14 +136,15 @@ def call_command(name, *args, **options):
# Load the command object.
try:
app_name = get_commands()[name]
- if isinstance(app_name, BaseCommand):
- # If the command is already loaded, use it directly.
- klass = app_name
- else:
- klass = load_command_class(app_name, name)
except KeyError:
raise CommandError("Unknown command: %r" % name)
+ if isinstance(app_name, BaseCommand):
+ # If the command is already loaded, use it directly.
+ klass = app_name
+ else:
+ klass = load_command_class(app_name, name)
+
# 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
# be called programatically, we need to simulate the loading and handling
Please sign in to comment.
Something went wrong with that request. Please try again.