Opened 11 years ago

Closed 11 years ago

Last modified 8 years ago

#7845 closed (fixed)

./ reset fails if app does not define models

Reported by: miracle2k Owned by: nobody
Component: Core (Management commands) Version: master
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


./ 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/ that doesn't seem to have any effect at all anyway (see patch).

Attachments (1)

reset-modelless-app.diff (1.0 KB) - added by miracle2k 11 years ago.

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by miracle2k

Attachment: reset-modelless-app.diff added

comment:1 Changed 11 years ago by James Bennett

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

comment:2 Changed 11 years ago by miracle2k

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 Changed 11 years ago by Eric Holscher

milestone: 1.0
Triage Stage: UnreviewedDesign decision needed

comment:4 Changed 11 years ago by Russell Keith-Magee

Resolution: fixed
Status: newclosed

(In [8401]) Fixes #7845: Removed a piece of stale code that was causing ./ reset to fail with apps that don't have any models. Thanks to miracle2k for the report and patch.

comment:5 Changed 8 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.
Back to Top