django-debug-toolbar: '<' not supported between instances of 'int' and 'str'
If session keys are not all strings, then this line (https://github.com/jazzband/django-debug-toolbar/blob/6a34e007e773d1243e3c7ba0b0ee07e4b45514ba/debug_toolbar/panels/request.py#L67) generate a TypeError:
TypeError at /myurl
'<' not supported between instances of 'int' and 'str'
because:
>>> l = ['a', 1, 'x', 22]
>>> sorted(l)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: '<' not supported between instances of 'int' and 'str'
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (17 by maintainers)
Thank you!
django-debug-toolbar shouldn’t crash anyway, but this makes it a normal priority issue for me. @tim-schilling Maybe something for the Djangocon sprints as well, if nobody gets to it earlier?
Yes, something like this. Please also spend some time constructing a test so that we do not regress in this area.
I think sorting is fine and helpful if it works. Otherwise we should just bail out and show keys and values in the order they appear in the dict.