[PATCH 3 of 5] hgweb: remove ErrorResponse.message

timeless at mozdev.org timeless at mozdev.org
Tue Sep 8 20:00:59 CDT 2015


# HG changeset patch
# User timeless at mozdev.org
# Date 1441738589 14400
#      Tue Sep 08 14:56:29 2015 -0400
# Node ID 52336c4a14e3c4e5642a07681cb10acb0bb29823
# Parent  143d8109b4e6e646faad6d6ebae0916025fd88c6
hgweb: remove ErrorResponse.message

BaseException.message is deprecated:
https://www.python.org/dev/peps/pep-0352/#retracted-ideas

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 @@
     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
@@ -294,7 +294,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
@@ -377,7 +377,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 templater(self, req):
 
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 @@
                     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):


More information about the Mercurial-devel mailing list