Commits

Gustavo Picon committed b3171d2

Simplified chained comparisons

Comments (0)

Files changed (2)

cherrypy/lib/tools/__init__.py

 
         since = request.headers.get('If-Unmodified-Since')
         if since and since != lastmod:
-            if (status >= 200 and status <= 299) or status == 412:
+            if (200 <= status <= 299) or status == 412:
                 raise cherrypy.HTTPError(412)
 
         since = request.headers.get('If-Modified-Since')
         if since and since == lastmod:
-            if (status >= 200 and status <= 299) or status == 304:
+            if (200 <= status <= 299) or status == 304:
                 if request.method in ("GET", "HEAD"):
                     raise cherrypy.HTTPRedirect([], 304)
                 else:

cherrypy/lib/tools/etags.py

     # MUST be ignored."
     if debug:
         cherrypy.log('Status: %s' % status, 'TOOLS.ETAGS')
-    if status >= 200 and status <= 299:
+    if 200 <= status <= 299:
         request = cherrypy.serving.request
 
         conditions = request.headers.elements('If-Match') or []