From: W. Trevor King Date: Thu, 20 Feb 2014 19:19:22 +0000 (-0800) Subject: server: Don't use a keyword for the response_headers argument to start_response X-Git-Tag: v0.1~24 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1b6b3a007ff24c92fac413c21dbd694c0d2b685f;p=package-cache.git server: Don't use a keyword for the response_headers argument to start_response 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 --- diff --git a/package_cache/server.py b/package_cache/server.py index b5a77f0..f31ddce 100644 --- a/package_cache/server.py +++ b/package_cache/server.py @@ -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):