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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

martinvonz (Martin von Zweigbergk)
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
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

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

martinvonz (Martin von Zweigbergk)
sheehan added a comment.


  The error I mentioned looks like this:
 
    Traceback (most recent call last):
      File "/var/hg/venv_hgweb/lib64/python3.6/site-packages/mercurial/hgweb/hgwebdir_mod.py", line 358, in run_wsgi
        for r in self._runwsgi(req, res):
      File "/var/hg/venv_hgweb/lib64/python3.6/site-packages/mercurial/hgweb/hgwebdir_mod.py", line 463, in _runwsgi
        res.setbodygen(tmpl.generate('error', {'error': e.message or ''}))
    AttributeError: 'ErrorResponse' object has no attribute 'message'

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6840/new/

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

To: sheehan, #hg-reviewers
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Reply | Threaded
Open this post in threaded view
|

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

martinvonz (Martin von Zweigbergk)
In reply to this post by martinvonz (Martin von Zweigbergk)
Closed by commit rHG8d9322b6e687: hgweb: add a `message` attribute to `hgweb.common.ErrorResponse` (authored by sheehan).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6840?vs=16508&id=16513

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D6840/new/

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, pulkit
Cc: mercurial-devel
_______________________________________________
Mercurial-devel mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel