#25372: "TypeError: unorderable types: NoneType() < bool()"
--------------------------------------------+--------------------
     Reporter:  blueyed                     |      Owner:  nobody
         Type:  Bug                         |     Status:  new
    Component:  Core (Management commands)  |    Version:  master
     Severity:  Normal                      |   Keywords:
 Triage Stage:  Unreviewed                  |  Has patch:  0
Easy pickings:  0                           |      UI/UX:  0
--------------------------------------------+--------------------
 I am seeing an error with manage.py's autocomplete for subcommands that do
 not use argparse:

 {{{
 % DJANGO_AUTO_COMPLETE=1 COMP_WORDS="manage.py shell_plus " COMP_CWORD=2
 python manage.py
 Traceback (most recent call last):
   File "…/project/bin/manage.py", line 8, in <module>
     execute_from_command_line(sys.argv)
   File "…/django18/django/core/management/__init__.py", line 351, in
 execute_from_command_line
     utility.execute()
   File "…/django18/django/core/management/__init__.py", line 327, in
 execute
     self.autocomplete()
   File "…/django18/django/core/management/__init__.py", line 264, in
 autocomplete
     options = sorted((k, v) for k, v in options if k.startswith(curr))
 TypeError: unorderable types: NoneType() < bool()
 }}}

 The problem appears to be that for subcommands that do not use argparse,
 `s_opt.nargs` does not get casted to a boolean:

 {{{
 if subcommand_cls.use_argparse:
     options.extend((sorted(s_opt.option_strings)[0], s_opt.nargs != 0) for
 s_opt in
                    parser._actions if s_opt.option_strings)
 else:
     options.extend((s_opt.get_opt_string(), s_opt.nargs) for s_opt in
                    parser.option_list)
 }}}

 The functions documentation says this:

   Subcommand options are saved as pairs. A pair consists of
   the long option string (e.g. '--exclude') and a boolean
   value indicating if the option requires arguments. When printing to
   stdout, an equal sign is appended to options which require arguments.

--
Ticket URL: <https://code.djangoproject.com/ticket/25372>
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/050.f3b761c9a49c0816eaecfd831cf7beaf%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to