##// END OF EJS Templates
hgweb: support custom http headers in ErrorResponse
Sune Foldager -
r7741:a3d7f99c default
parent child Browse files
Show More
@@ -17,9 +17,10 b' HTTP_METHOD_NOT_ALLOWED = 405'
17 HTTP_SERVER_ERROR = 500
17 HTTP_SERVER_ERROR = 500
18
18
19 class ErrorResponse(Exception):
19 class ErrorResponse(Exception):
20 def __init__(self, code, message=None):
20 def __init__(self, code, message=None, headers=[]):
21 Exception.__init__(self)
21 Exception.__init__(self)
22 self.code = code
22 self.code = code
23 self.headers = headers
23 if message is not None:
24 if message is not None:
24 self.message = message
25 self.message = message
25 else:
26 else:
@@ -77,6 +77,7 b' class wsgirequest(object):'
77
77
78 if isinstance(status, ErrorResponse):
78 if isinstance(status, ErrorResponse):
79 status = statusmessage(status.code)
79 status = statusmessage(status.code)
80 self.header(status.headers)
80 elif status == 200:
81 elif status == 200:
81 status = '200 Script output follows'
82 status = '200 Script output follows'
82 elif isinstance(status, int):
83 elif isinstance(status, int):
General Comments 0
You need to be logged in to leave comments. Login now