Commit 90a9b987 authored by Vincent Pelletier's avatar Vincent Pelletier

wsgi: Call start_response from a single place.

Prepares for CORS headers auto-generation.
parent 87ebda84
...@@ -36,7 +36,9 @@ class ApplicationError(Exception): ...@@ -36,7 +36,9 @@ class ApplicationError(Exception):
WSGI HTTP error base class. WSGI HTTP error base class.
""" """
status = _getStatus(httplib.INTERNAL_SERVER_ERROR) status = _getStatus(httplib.INTERNAL_SERVER_ERROR)
response_headers = () @property
def response_headers(self):
return []
class BadRequest(ApplicationError): class BadRequest(ApplicationError):
""" """
...@@ -160,15 +162,13 @@ class Application(object): ...@@ -160,15 +162,13 @@ class Application(object):
traceback.print_exc(file=sys.stderr) traceback.print_exc(file=sys.stderr)
raise ApplicationError raise ApplicationError
except ApplicationError, e: except ApplicationError, e:
start_response( status = e.status
e.status, header_list = e.response_headers
list(e.response_headers),
)
result = [str(x) for x in e.args] result = [str(x) for x in e.args]
else:
start_response( start_response(
status, status,
header_list, header_list + [
],
) )
return result return result
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment