mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
hgweb: remove ErrorResponse.message
BaseException.message is deprecated: https://www.python.org/dev/peps/pep-0352/#retracted-ideas
This commit is contained in:
parent
4af6115a32
commit
9059b84547
@ -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):
|
||||
|
@ -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:
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user