Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

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

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

Download all attachments as: .zip

Change History (6)

by miracle2k, 16 years ago

Attachment: reset-modelless-app.diff added

comment:1 by James Bennett, 16 years ago

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 by miracle2k, 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 Eric Holscher, 16 years ago

milestone: 1.0
Triage Stage: UnreviewedDesign decision needed

comment:4 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

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

comment:5 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

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