From 2545dc1e752a960f4dc0d0e48426fdfd9ef79cb6 Mon Sep 17 00:00:00 2001 From: amitt001 Date: Fri, 28 Oct 2016 11:06:33 +0530 Subject: < python 3.5.x non-enum HTTPStatus support --- src/mailman/rest/wsgiapp.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mailman/rest/wsgiapp.py b/src/mailman/rest/wsgiapp.py index fe1a9fd63..f499ec60b 100644 --- a/src/mailman/rest/wsgiapp.py +++ b/src/mailman/rest/wsgiapp.py @@ -78,7 +78,11 @@ class AdminWebServiceWSGIRequestHandler(WSGIRequestHandler): def send_error(self, code, message=None, explain=None): """See `BaseHTTPRequestHandler`.""" - err_code = "{0} {1}".format(code.value, code.name.replace('_', ' ')) + try: + shortmsg, longmsg = self.responses[code] + except KeyError: + shortmsg, longmsg = '???', '???' + err_code = "{0} {1}".format(int(code), shortmsg) header_dict = dict( status="{0} {1}".format(self.request_version, err_code), rsp_date=time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.gmtime()), -- cgit v1.2.3-70-g09d2