Commits

Robert Brewer  committed d5b2ee4

Fixes for header.elements now returning [] instead of None.

  • Participants
  • Parent commits 4e739b7

Comments (0)

Files changed (3)

File cherrypy/filters/decodingfilter.py

         enc = conf('decoding_filter.encoding', None)
         if not enc:
             ct = cherrypy.request.headers.elements("Content-Type")
-            if ct is not None:
+            if ct:
                 ct = ct[0]
                 enc = ct.params.get("charset", None)
                 if (not enc) and ct.value.lower().startswith("text/"):

File cherrypy/filters/encodingfilter.py

             return
         
         ct = cherrypy.response.headers.elements("Content-Type")
-        if ct is not None:
+        if ct:
             ct = ct[0]
             if ct.value.lower().startswith("text/"):
                 # Set "charset=..." param on response Content-Type header
     default_enc = conf('encoding_filter.default_encoding', 'utf-8')
     
     encs = cherrypy.request.headerMap.elements('Accept-Charset')
-    if encs is None:
+    if not encs:
         # Any character-set is acceptable.
         charsets = []
         if encode(default_enc):

File cherrypy/filters/gzipfilter.py

         
         from cherrypy.lib import httptools
         acceptable = cherrypy.request.headers.elements('Accept-Encoding')
-        if acceptable is None:
+        if not acceptable:
             # If no Accept-Encoding field is present in a request,
             # the server MAY assume that the client will accept any
             # content coding. In this case, if "identity" is one of