Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/common.py @ 42926:8d9322b6e687
hgweb: add a `message` attribute to `hgweb.common.ErrorResponse`
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
Differential Revision: https://phab.mercurial-scm.org/D6840
author | Connor Sheehan <sheehan@mozilla.com> |
---|---|
date | Tue, 10 Sep 2019 12:32:07 -0400 |
parents | d216ae4cc3f6 |
children | 2372284d9457 |
comparison
equal
deleted
inserted
replaced
42925:4690902850df | 42926:8d9322b6e687 |
---|---|
104 Exception.__init__(self, pycompat.sysstr(message)) | 104 Exception.__init__(self, pycompat.sysstr(message)) |
105 self.code = code | 105 self.code = code |
106 if headers is None: | 106 if headers is None: |
107 headers = [] | 107 headers = [] |
108 self.headers = headers | 108 self.headers = headers |
109 self.message = message | |
109 | 110 |
110 class continuereader(object): | 111 class continuereader(object): |
111 """File object wrapper to handle HTTP 100-continue. | 112 """File object wrapper to handle HTTP 100-continue. |
112 | 113 |
113 This is used by servers so they automatically handle Expect: 100-continue | 114 This is used by servers so they automatically handle Expect: 100-continue |