hgweb: remove ErrorResponse.message

BaseException.message is deprecated:
https://www.python.org/dev/peps/pep-0352/#retracted-ideas
This commit is contained in:
timeless@mozdev.org 2015-09-08 14:56:29 -04:00
parent 4af6115a32
commit 9059b84547
3 changed files with 4 additions and 7 deletions

View File

@ -80,12 +80,9 @@ class ErrorResponse(Exception):
def __init__(self, code, message=None, headers=[]):
if message is None:
message = _statusmessage(code)
Exception.__init__(self)
Exception.__init__(self, message)
self.code = code
self.message = message
self.headers = headers
def __str__(self):
return self.message
class continuereader(object):
def __init__(self, f, write):

View File

@ -356,7 +356,7 @@ class hgweb(object):
else:
req.headers.append(('Connection', 'Close'))
req.respond(inst, protocol.HGTYPE,
body='0\n%s\n' % inst.message)
body='0\n%s\n' % inst)
return ''
# translate user-visible url structure to internal structure
@ -439,7 +439,7 @@ class hgweb(object):
if inst.code == HTTP_NOT_MODIFIED:
# Not allowed to return a body on a 304
return ['']
return tmpl('error', error=inst.message)
return tmpl('error', error=str(inst))
def check_perm(self, rctx, req, op):
for permhook in permhooks:

View File

@ -100,7 +100,7 @@ class wsgirequest(object):
self.headers = [(k, v) for (k, v) in self.headers if
k in ('Date', 'ETag', 'Expires',
'Cache-Control', 'Vary')]
status = statusmessage(status.code, status.message)
status = statusmessage(status.code, str(status))
elif status == 200:
status = '200 Script output follows'
elif isinstance(status, int):