Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27000 closed Cleanup/optimization (fixed)

Django manage Command.usage() is broken

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

Description

This method access self.args which is not set.

How to reproduce:

import os

import django

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "untitled8.settings")


django.setup()

from django.core.management.commands import createcachetable

createcachetable.Command().usage("")

Result:

    usage = '%%prog %s [options] %s' % (subcommand, self.args)
AttributeError: 'Command' object has no attribute 'args'

Change History (4)

comment:1 by Tim Graham, 8 years ago

Has patch: set
Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

It looks like that method should have been removed along with optparse support in 6a70cb53971a19f2d9e71d5ee24bfb0e844b4d9d.

PR

comment:2 by Simon Charette, 8 years ago

@throwable-one, you can probably achieve similar result by using Command().create_parser.

comment:3 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In ccd5a23f:

Fixed #27000 -- Removed BaseCommand.usage() per deprecation timeline (refs #19973).

comment:4 by Tim Graham <timograham@…>, 8 years ago

In 7dd8e53c:

[1.10.x] Fixed #27000 -- Removed BaseCommand.usage() per deprecation timeline (refs #19973).

Backport of ccd5a23fba91e66656bb19b60bb6d737cab728f5 from master

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