summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2013-10-17 18:57:44 +0200
committerClaude Paroz <claude@2xlibre.net>2013-10-18 14:05:26 +0200
commit621fc1f1d74df2d9240dea88b5f7ebdf472bca38 (patch)
tree8ba1f170d54e42deb94a6157d3938ec1d0e3efe5 /django
parent37afcbeb92cd556ff1081c9db5a4a320efd5b7a3 (diff)
[1.6.x] Fixed #21284 -- Prevented KeyError swallowing in fetch_command
Thanks wildfire for the report. Backport of 3514bcb251 from master.
Diffstat (limited to 'django')
-rw-r--r--django/core/management/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py
index 8fd46aa759..5b0ad6c4b9 100644
--- a/django/core/management/__init__.py
+++ b/django/core/management/__init__.py
@@ -257,8 +257,10 @@ class ManagementUtility(object):
appropriate command called from the command line (usually
"django-admin.py" or "manage.py") if it can't be found.
"""
+ # Get commands outside of try block to prevent swallowing exceptions
+ commands = get_commands()
try:
- app_name = get_commands()[subcommand]
+ app_name = commands[subcommand]
except KeyError:
sys.stderr.write("Unknown command: %r\nType '%s help' for usage.\n" % \
(subcommand, self.prog_name))