diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py +++ b/mercurial/hgweb/common.py @@ -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): diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -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: diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -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):