#7845 closed (fixed)
./manage.py reset fails if app does not define models
Reported by: | miracle2k | Owned by: | nobody |
---|---|---|---|
Component: | Core (Management commands) | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Design decision needed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
./manage.py reset fails with an obscure IndexError if an app does not define models.
There seems to be no strong reason why it should fail though, and in fact the problem is a line in core/management/sql.py that doesn't seem to have any effect at all anyway (see patch).
Attachments (1)
Change History (6)
by , 16 years ago
Attachment: | reset-modelless-app.diff added |
---|
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Well, lack of models in an application that you expect to be there seems like a pretty big error, that surely should surface easily at some other point. And while I am unable to check check right now, I think I remember that most of the other commands involving models don't complain either, so I'd be in line with that behaviour.
I was in fact scripting management when I stumbled on this, iterating over INSTALLED_APPS and calling call_command'ing "reset". I'm able to workaround that problem of course by checking with get_app(emptyOK=True) and get_models() myself, so it's not that big a deal.
comment:3 by , 16 years ago
milestone: | → 1.0 |
---|---|
Triage Stage: | Unreviewed → Design decision needed |
comment:4 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Since
reset
is intended to drop and re-create tables belonging to the models defined in an application, shouldn't resetting a model-less application be an error? Silently passing on this situation seems like a bad idea, since that may well mask deeper errors (e.g., if someone's scripting management commands, this could hide bugs in their script).