﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
13760	Management commands should not specify the default value twice	Paul McMillan	nobody	"Many of the management commands have a code pattern that seems likely to invite errors:

In the base of the Command class, they define options, including default values like this:

{{{
class Command(BaseCommand):
    option_list = BaseCommand.option_list + (
        make_option('--format', default='json', dest='format',
            help='Specifies the output serialization format for fixtures.'),
}}}

Then later on in the handle method, they get the option value, specifying a new default value if the option is not found, like this:

{{{
    def handle(self, *app_labels, **options):
        format = options.get('format','json')
}}}

This second default value is an error. Using optparse means that we are certain to receive a value for each option (it defaults to None). Using options.get() with a default value is redundant. Trying to get a non-existent option should throw an error, not return a default value.

Most of the management commands need this cleanup.
"	Cleanup/optimization	closed	Core (Management commands)	1.2	Normal	fixed			Ready for checkin	1	0	0	0	0	0
