Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #19257 -- Don't swallow command's KeyError in call_command

Thanks Giovanni Bajo for the report.
  • Loading branch information...
commit 9a09558e9f20e088b4526fff6374a53e877cf5ec 1 parent e8f6960
Claude Paroz authored November 07, 2012

Showing 1 changed file with 6 additions and 5 deletions. Show diff stats Hide diff stats

  1. 11  django/core/management/__init__.py
11  django/core/management/__init__.py
@@ -136,14 +136,15 @@ def call_command(name, *args, **options):
136 136
     # Load the command object.
137 137
     try:
138 138
         app_name = get_commands()[name]
139  
-        if isinstance(app_name, BaseCommand):
140  
-            # If the command is already loaded, use it directly.
141  
-            klass = app_name
142  
-        else:
143  
-            klass = load_command_class(app_name, name)
144 139
     except KeyError:
145 140
         raise CommandError("Unknown command: %r" % name)
146 141
 
  142
+    if isinstance(app_name, BaseCommand):
  143
+        # If the command is already loaded, use it directly.
  144
+        klass = app_name
  145
+    else:
  146
+        klass = load_command_class(app_name, name)
  147
+
147 148
     # Grab out a list of defaults from the options. optparse does this for us
148 149
     # when the script runs from the command line, but since call_command can
149 150
     # be called programatically, we need to simulate the loading and handling

0 notes on commit 9a09558

Please sign in to comment.
Something went wrong with that request. Please try again.