diff options
| author | Claude Paroz <claude@2xlibre.net> | 2013-10-17 18:57:44 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2013-10-17 18:57:44 +0200 |
| commit | 3514bcb251fb623dbd07911e53d417d55934ffa5 (patch) | |
| tree | b52d2fda01adbc06bcaa2e6e48865c1facce88a4 /django/core | |
| parent | a14f08723304be27e851c753a68c8200473a9ca1 (diff) | |
Fixed #21284 -- Prevented KeyError swallowing in fetch_command
Thanks wildfire for the report.
Diffstat (limited to 'django/core')
| -rw-r--r-- | django/core/management/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index eac95e6b37..19aaa4aedc 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)) |
