D6840: hgweb: add a `message` attribute to `hgweb.common.ErrorResponse`

sheehan (Connor Sheehan) phabricator at mercurial-scm.org
Tue Sep 10 20:10:37 UTC 2019


sheehan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This fixes a Python 3 bug where hgweb assumes an Exception
  subclass will have a `.message` attribute after running
  `Exception.__init__`.[1] The Python 3 way to get this info would
  be `e.args[0]`, but adding a new named attribute is more
  ergonomic in my view.
  
  [1] https://www.mercurial-scm.org/repo/hg-committed/file/6ccf539aec71/mercurial/hgweb/hgwebdir_mod.py#l459

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6840

AFFECTED FILES
  mercurial/hgweb/common.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/common.py b/mercurial/hgweb/common.py
--- a/mercurial/hgweb/common.py
+++ b/mercurial/hgweb/common.py
@@ -106,6 +106,7 @@
         if headers is None:
             headers = []
         self.headers = headers
+        self.message = message
 
 class continuereader(object):
     """File object wrapper to handle HTTP 100-continue.



To: sheehan, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list