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):
WSGI HTTP error base class.
"""
status = _getStatus(httplib.INTERNAL_SERVER_ERROR)
response_headers = ()
@property
def response_headers(self):
return []
class BadRequest(ApplicationError):
"""
......@@ -160,16 +162,14 @@ class Application(object):
traceback.print_exc(file=sys.stderr)
raise ApplicationError
except ApplicationError, e:
start_response(
e.status,
list(e.response_headers),
)
status = e.status
header_list = e.response_headers
result = [str(x) for x in e.args]
else:
start_response(
status,
header_list,
)
start_response(
status,
header_list + [
],
)
return result
@staticmethod
......
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