﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18706	django.utils.http.int_to_base36 raises ValueError instead of TypeError for invalid input	Aymeric Augustin	Aymeric Augustin	"This behavior seems wrong to me, and unfortunately, [https://github.com/django/django/blob/master/tests/regressiontests/utils/http.py#L117 it's tested].

Keeping it in Python 3 is needlessly complicated. Python 3 will rightly raise a `TypeError` for invalid comparisons. Catching it and re-raising a less appropriate `ValueError` seems just wrong to me.



Python 2:
{{{
>>> 0 <= '' <= 2**31 - 1
False
}}}

Python 3:
{{{
>>> 0 <= '' <= 2**31 - 1
Traceback (most recent call last):
  File ""<stdin>"", line 1, in <module>
TypeError: unorderable types: int() <= str()
}}}

I'm attaching a patch that adds Python 3 compatibility (we can't use `sys.maxint` any longer) and improves the handling of invalid inputs under Python 2."	Bug	closed	Core (Other)	dev	Normal	fixed			Accepted	1	0	0	0	0	0
