diff --git a/django/utils/http.py b/django/utils/http.py index 1431f47246..d343a375c0 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -171,7 +171,7 @@ def int_to_base36(i): """ digits = "0123456789abcdefghijklmnopqrstuvwxyz" factor = 0 - if (i < 0) or (i > sys.maxint): + if not 0 <= i <= sys.maxint: raise ValueError("Base36 conversion input too large or incorrect type.") # Find starting factor while True: diff --git a/tests/regressiontests/utils/http.py b/tests/regressiontests/utils/http.py index a6e7a8f2fc..16c7daa32c 100644 --- a/tests/regressiontests/utils/http.py +++ b/tests/regressiontests/utils/http.py @@ -119,6 +119,6 @@ class TestUtilsHttp(unittest.TestCase): self.assertRaises(TypeError, http.int_to_base36, 3.141) # more explicit output testing - for n, b36 in [(0,'0'), (1,'1'), (42,'16'), (818469960,'django')]: + for n, b36 in [(0, '0'), (1, '1'), (42, '16'), (818469960, 'django')]: self.assertEqual(http.int_to_base36(n), b36) self.assertEqual(http.base36_to_int(b36), n)