Opened 12 years ago
Closed 12 years ago
#19257 closed Bug (fixed)
KeyError swallowed while loading command classes
Reported by: | giovannibajo | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | 1.4 |
Severity: | Normal | Keywords: | |
Cc: | giovannibajo | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
The code in django.core.management.call_command() swallows all KeyErrors generated while loading a command class, and turns them into a "command unknown" error message.
The Test command for instance executes user's code while loading the command class (see django.test.simple, line 36), so any kind of KeyError in user code while running tests gets swallowed and turned into a "unknown command test", which baffles the user.
I don't know whether it's a bug in call_command() (should check for KeyErrors only while looking up a command in the command dictionaries) or in the test framework (shouldn't let user exceptions slip out of simple.py).
Change History (3)
comment:1 by , 12 years ago
Cc: | added |
---|
comment:2 by , 12 years ago
Easy pickings: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I think you are right and that the
except KeyError
clause should only catch forget_commands()[name]
.