server: Don't use a keyword for the response_headers argument to start_response
authorW. Trevor King <wking@tremily.us>
Thu, 20 Feb 2014 19:19:22 +0000 (11:19 -0800)
committerW. Trevor King <wking@tremily.us>
Thu, 20 Feb 2014 19:23:44 +0000 (11:23 -0800)
Despite being documented as response_headers [1], using a keyword
argument raises a TypeError:

  TypeError: start_response() got an unexpected keyword argument 'response_headers'

[1]: http://legacy.python.org/dev/peps/pep-0333/#the-start-response-callable

package_cache/server.py

index b5a77f0445dccd1aa2ef9ee0980549a427d66790..f31ddce078024155dfa0ade8a4de6dddf3e2765e 100644 (file)
@@ -24,7 +24,7 @@ class Server (object):
             return self._serve_request(
                 environ=environ, start_response=start_response)
         except InvalidFile:
-            start_response(status='404 Not Found', response_headers=[])
+            start_response('404 Not Found', [])
 
     def _serve_request(self, environ, start_response):
         method = environ['REQUEST_METHOD']
@@ -55,9 +55,7 @@ class Server (object):
             file_iterator = environ['wsgi.file_wrapper'](f)
         else:
             file_iterator = iter(lambda: f.read(block_size), '')
-        start_response(
-            status='200 OK',
-            response_headers=list(headers.items()))
+        start_response('200 OK', list(headers.items()))
         return file_iterator
 
     def _get_content_length(self, path):