hgweb: remove ErrorResponse.message
authortimeless@mozdev.org
Tue, 08 Sep 2015 14:56:29 -0400
changeset 26200 461e7b700fdf
parent 26199 5411059d93f8
child 26201 c5b2074ae8c0
hgweb: remove ErrorResponse.message BaseException.message is deprecated: https://www.python.org/dev/peps/pep-0352/#retracted-ideas
mercurial/hgweb/common.py
mercurial/hgweb/hgweb_mod.py
mercurial/hgweb/request.py
--- a/mercurial/hgweb/common.py	Fri Sep 04 05:57:58 2015 -0400
+++ b/mercurial/hgweb/common.py	Tue Sep 08 14:56:29 2015 -0400
@@ -80,12 +80,9 @@
     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):
--- a/mercurial/hgweb/hgweb_mod.py	Fri Sep 04 05:57:58 2015 -0400
+++ b/mercurial/hgweb/hgweb_mod.py	Tue Sep 08 14:56:29 2015 -0400
@@ -356,7 +356,7 @@
                 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 @@
             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:
--- a/mercurial/hgweb/request.py	Fri Sep 04 05:57:58 2015 -0400
+++ b/mercurial/hgweb/request.py	Tue Sep 08 14:56:29 2015 -0400
@@ -100,7 +100,7 @@
                     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):