Opened 9 years ago

Closed 9 years ago

#6782 closed (duplicate)

reset on apps without models causes exception

Reported by: niklas@… Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Malcolm Tredinnick)

The orders and customers apps contain no models. This causes the exception below

apps = ['resources', 'orders', 'common', 'customers']
management.call_command('reset', *apps)

Traceback (most recent call last):
  File "S:\nc\Projects\Inventive\Ticmate\svn\ticmate\trunk\source\python\ticmate\django\scripts\ticrun.py", line 249, in <module>
    func()
  File "S:\nc\Projects\Inventive\Ticmate\svn\ticmate\trunk\source\python\ticmate\django\scripts\ticrun.py", line 90, in tr_reset
    tr_reset_no_reload()
  File "S:\nc\Projects\Inventive\Ticmate\svn\ticmate\trunk\source\python\ticmate\django\scripts\ticrun.py", line 145, in tr_reset_no_reload
    tr_reset_apps()
  File "S:\nc\Projects\Inventive\Ticmate\svn\ticmate\trunk\source\python\ticmate\django\scripts\ticrun.py", line 149, in tr_reset_apps
    reset_apps()
  File "S:\nc\Projects\Inventive\Ticmate\svn\ticmate\trunk\source\python\ticmate\django\scripts\ticrun.py", line 171, in reset_apps
    management.call_command('reset', *apps)#, verbosity=2, noinput=True)
  File "S:\nc\Projects\Inventive\Ticmate\svn\django-trunk\django\core\management\__init__.py", line 126, in call_command
    return klass.execute(*args, **options)
  File "S:\nc\Projects\Inventive\Ticmate\svn\django-trunk\django\core\management\base.py", line 86, in execute
    output = self.handle(*args, **options)
  File "S:\nc\Projects\Inventive\Ticmate\svn\django-trunk\django\core\management\base.py", line 136, in handle
    app_output = self.handle_app(app, **options)
  File "S:\nc\Projects\Inventive\Ticmate\svn\django-trunk\django\core\management\commands\reset.py", line 24, in handle_app
    sql_list = sql_reset(app, self.style)
  File "S:\nc\Projects\Inventive\Ticmate\svn\django-trunk\django\core\management\sql.py", line 206, in sql_reset
    return sql_delete(app, style) + sql_all(app, style)
  File "S:\nc\Projects\Inventive\Ticmate\svn\django-trunk\django\core\management\sql.py", line 194, in sql_delete
    app_label = app_models[0]._meta.app_label
IndexError: list index out of range

Change History (3)

comment:1 Changed 9 years ago by anonymous

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

It looks a bit messy but I don't know how to edit the description. Thought i might put it in dpaste.com instead?

comment:2 Changed 9 years ago by Malcolm Tredinnick

Description: modified (diff)
Triage Stage: UnreviewedAccepted

Fixed description.

Since it makes no sense to run "reset" on an app with no models, the solution here is "don't do that". Maybe somebody will fix it at some point, but it's not particularly high priority.

comment:3 Changed 9 years ago by loppear

Resolution: duplicate
Status: newclosed

Duplicate of ticket:5066

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