Opened 9 years ago

Last modified 9 years ago

#24518 closed Bug

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

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 (last modified by Thierry Jossermoz)

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 in django/core/management/base.py:

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 (1)

comment:1 by Thierry Jossermoz, 9 years ago

Description: modified (diff)
Status: newassigned
Note: See TracTickets for help on using tickets.
Back to Top