1
0
mirror of https://github.com/django/django.git synced 2025-10-27 07:36:08 +00:00

Fixed #21284 -- Prevented KeyError swallowing in fetch_command

Thanks wildfire for the report.
This commit is contained in:
Claude Paroz
2013-10-17 18:57:44 +02:00
parent a14f087233
commit 3514bcb251
2 changed files with 21 additions and 15 deletions

View File

@@ -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))