Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use Python's changed comparisons, which makes this a bit more readable.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17526 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit b9b3e9f0efe3fe9d5d976533ff2f13359825f5da 1 parent 6072e10
Alex Gaynor authored February 16, 2012
2  django/utils/http.py
@@ -171,7 +171,7 @@ def int_to_base36(i):
171 171
     """
172 172
     digits = "0123456789abcdefghijklmnopqrstuvwxyz"
173 173
     factor = 0
174  
-    if (i < 0) or (i > sys.maxint):
  174
+    if not 0 <= i <= sys.maxint:
175 175
         raise ValueError("Base36 conversion input too large or incorrect type.")
176 176
     # Find starting factor
177 177
     while True:
2  tests/regressiontests/utils/http.py
@@ -119,6 +119,6 @@ def test_base36(self):
119 119
         self.assertRaises(TypeError, http.int_to_base36, 3.141)
120 120
         
121 121
         # more explicit output testing
122  
-        for n, b36 in [(0,'0'), (1,'1'), (42,'16'), (818469960,'django')]:
  122
+        for n, b36 in [(0, '0'), (1, '1'), (42, '16'), (818469960, 'django')]:
123 123
             self.assertEqual(http.int_to_base36(n), b36)
124 124
             self.assertEqual(http.base36_to_int(b36), n)

0 notes on commit b9b3e9f

Please sign in to comment.
Something went wrong with that request. Please try again.