﻿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
24969	Backwards compatibility for optparse in management commands broken for overrides.	Paul Butcher	nobody	"Since this change:
https://github.com/django/django/commit/856863860352aa1f0288e6c9168a0e423c4f5184

The built-in options are always added, regardless of what is in option_list for the Command.

Management commands that, in previous versions, overrode or replaced items in the default option_list now raise an OptionConflictError on invocation.

This was noticed using Lettuce, (http://lettuce.it/), where invocation, thus:

{{{$ python manage.py harvest}}}

gives the following response

{{{optparse.OptionConflictError: option -v/--verbosity: conflicting option string(s): -v, --verbosity}}}



The `harvest` management command replaces the verbosity option, by removing it from the option_list, thus:

{{{

class Command(BaseCommand):
    help = u'Run lettuce tests all along installed apps'
    args = '[PATH to feature file or folder]'
    requires_model_validation = False

    option_list = BaseCommand.option_list[1:] + (
        make_option('-v', '--verbosity', action='store', dest='verbosity', default='4',
            type='choice', choices=map(str, range(5)),
            help='Verbosity level; 0=no output, 1=only dots, 2=only scenario names, 3=colorless output, 4=normal output (colorful)'),
...
}}}

Lettuce has a its [https://github.com/gabrielfalcao/lettuce/issues/480 own corresponding version of this issue].

In earlier versions of Django, verbosity was the first item in BaseCommand.option_list, so was discarded and replaced by the result of make_option above.  

In the current version, BaseCommand.option_list is no longer a collection of defaults, and its former content is now mandatory and added independently.

This problem does not necessarily arise using argparse, as the derived class has greater control by overriding `add_arguments`"	Uncategorized	closed	Core (Management commands)	1.8	Normal	worksforme			Unreviewed	0	0	0	0	0	0
