Django

Code

Ticket #7845 (closed: fixed)

Opened 5 months ago

Last modified 4 months ago

./manage.py reset fails if app does not define models

Reported by: miracle2k Assigned to: nobody
Milestone: 1.0 Component: django-admin.py
Version: SVN Keywords:
Cc: Triage Stage: Design decision needed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

reset-modelless-app.diff (1.0 kB) - added by miracle2k on 07/19/08 17:36:50.

Change History

07/19/08 17:36:50 changed by miracle2k

  • attachment reset-modelless-app.diff added.

07/20/08 05:46:22 changed by ubernostrum

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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

07/20/08 06:39:57 changed 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.

08/08/08 14:37:14 changed by ericholscher

  • stage changed from Unreviewed to Design decision needed.
  • milestone set to 1.0.

08/15/08 23:11:39 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #7845 (./manage.py reset fails if app does not define models)




Change Properties
Action