Opened 2 years ago

Closed 2 years ago

Last modified 2 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 Changed 2 years ago by Tim Graham

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 Changed 2 years ago by Simon Charette

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

comment:3 Changed 2 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: newclosed

In ccd5a23f:

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

comment:4 Changed 2 years ago by Tim Graham <timograham@…>

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