Opened 10 years ago

Last modified 10 years ago

#24518 closed Bug

OptionParser verbosity not cast to int (Python3) — at Initial Version

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

Description

With Python3, when not using argparse for a management command, the verbosity option uses a type=choice, which leads to a TypeError: unorderable types: str() > int() in django/core/management/commands/test.py at line 65 (if options['verbosity'] > 0)

The problem comes from this line:

parser.add_option('-v', '--verbosity', action='store', dest='verbosity', default='1',
    type='choice', choices=['0', '1', '2', '3'],
    help='Verbosity level; 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output')

Change History (0)

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