[Django] #25372: "TypeError: unorderable types: NoneType() < bool()"

9 views
Skip to first unread message

Django

unread,
Sep 9, 2015, 10:23:51 AM9/9/15
to django-...@googlegroups.com
#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.

Django

unread,
Sep 9, 2015, 10:27:42 AM9/9/15
to django-...@googlegroups.com
#25372: "TypeError: unorderable types: NoneType() < bool()"
-------------------------------------+-------------------------------------

Reporter: blueyed | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by blueyed):

* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0


Old description:

New description:

PR: https://github.com/django/django/pull/5253

--

--
Ticket URL: <https://code.djangoproject.com/ticket/25372#comment:1>

Django

unread,
Sep 9, 2015, 10:41:51 AM9/9/15
to django-...@googlegroups.com
#25372: "TypeError: unorderable types: NoneType() < bool()"
-------------------------------------+-------------------------------------

Reporter: blueyed | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by MoritzS):

Can you provide a simple test case for this error?

--
Ticket URL: <https://code.djangoproject.com/ticket/25372#comment:2>

Django

unread,
Sep 9, 2015, 10:45:19 AM9/9/15
to django-...@googlegroups.com
#25372: TypeError on manage.py's autocomplete for subcommands that do not use
argparse
-------------------------------------+-------------------------------------

Reporter: blueyed | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/25372#comment:3>

Django

unread,
Sep 9, 2015, 2:30:32 PM9/9/15
to django-...@googlegroups.com
#25372: TypeError on manage.py's autocomplete for subcommands that do not use
argparse
-------------------------------------+-------------------------------------

Reporter: blueyed | Owner: nobody
Type: Bug | Status: new
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Unreviewed => Ready for checkin


Comment:

As the issue is in deprecated code that will be removed in Django 1.10 and
seems unlikely to regress, I guess we can just commit the fix.

--
Ticket URL: <https://code.djangoproject.com/ticket/25372#comment:4>

Django

unread,
Sep 9, 2015, 2:52:08 PM9/9/15
to django-...@googlegroups.com
#25372: TypeError on manage.py's autocomplete for subcommands that do not use
argparse
-------------------------------------+-------------------------------------
Reporter: blueyed | Owner: nobody
Type: Bug | Status: closed

Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"acb833081dd3abca3bc62753103690f23fb3f0ec" acb83308]:
{{{
#!CommitTicketReference repository=""
revision="acb833081dd3abca3bc62753103690f23fb3f0ec"
Fixed #25372 -- Fixed autocompletion for options of non-argparse commands.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25372#comment:5>

Django

unread,
Sep 10, 2015, 8:47:21 PM9/10/15
to django-...@googlegroups.com
#25372: TypeError on manage.py's autocomplete for subcommands that do not use
argparse
-------------------------------------+-------------------------------------
Reporter: blueyed | Owner: nobody

Type: Bug | Status: closed
Component: Core (Management | Version: master
commands) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"6c19d819515cd9b03e02d195604056fea89e6a54" 6c19d81]:
{{{
#!CommitTicketReference repository=""
revision="6c19d819515cd9b03e02d195604056fea89e6a54"
[1.8.x] Fixed #25372 -- Fixed autocompletion for options of non-argparse
commands.

Backport of acb833081dd3abca3bc62753103690f23fb3f0ec from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25372#comment:6>

Reply all
Reply to author
Forward
0 new messages