#24518: OptionParser verbosity not cast to int (Python3)
-------------------------------------+-------------------------------------
     Reporter:  jthi3rry             |                    Owner:  jthi3rry
         Type:  Bug                  |                   Status:  assigned
    Component:  Core (Management     |                  Version:  1.8rc1
  commands)                          |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by jthi3rry):

 * status:  new => assigned
 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0


Old 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')
> }}}

New 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 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')
 }}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24518#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.99f1f3e2fb33e7c6ddc87fa86b8f4006%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to