summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-11-07 18:24:49 +0100
committerClaude Paroz <claude@2xlibre.net>2012-11-07 18:28:53 +0100
commit9a09558e9f20e088b4526fff6374a53e877cf5ec (patch)
tree8e831387877dfcf4d96168205b7d898d193e84c9
parente8f696097b19abbd3a98990ea4ca5f58d0444826 (diff)
Fixed #19257 -- Don't swallow command's KeyError in call_command
Thanks Giovanni Bajo for the report.
-rw-r--r--django/core/management/__init__.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index c61ab2b663..bb26c20666 100644
--- a/django/core/management/__init__.py
+++ b/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