Mercurial > public > mercurial-scm > hg
comparison mercurial/wireprotov2server.py @ 46697:71443f742886 stable
wireprotoserver: convert ErrorResponse to bytes
Caught by pytype:
File "/mnt/c/Users/Matt/hg/mercurial/wireprotoserver.py", line 236, in handlewsgirequest: Function _bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, ints: Iterable[int])
Actually passed: (self, ints: mercurial.hgweb.common.ErrorResponse)
The following methods aren't implemented on mercurial.hgweb.common.ErrorResponse:
__iter__
File "/mnt/c/Users/Matt/hg/mercurial/wireprotoserver.py", line 239, in handlewsgirequest: Function _bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, ints: Iterable[int])
Actually passed: (self, ints: mercurial.hgweb.common.ErrorResponse)
The following methods aren't implemented on mercurial.hgweb.common.ErrorResponse:
__iter__
File "/mnt/c/Users/Matt/hg/mercurial/wireprotov2server.py", line 91, in handlehttpv2request: Function _bytestr.__init__ was called with the wrong arguments [wrong-arg-types]
Expected: (self, ints: Iterable[int])
Actually passed: (self, ints: mercurial.hgweb.common.ErrorResponse)
The following methods aren't implemented on mercurial.hgweb.common.ErrorResponse:
__iter__
Differential Revision: https://phab.mercurial-scm.org/D10182
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Thu, 11 Mar 2021 21:07:04 -0500 |
parents | 14ff4929ca8c |
children | d4ba4d51f85f |
comparison
equal
deleted
inserted
replaced
46696:ed0899e01628 | 46697:71443f742886 |
---|---|
86 # TODO return reasonable responses - not responses that overload the | 86 # TODO return reasonable responses - not responses that overload the |
87 # HTTP status line message for error reporting. | 87 # HTTP status line message for error reporting. |
88 try: | 88 try: |
89 checkperm(rctx, req, b'pull' if permission == b'ro' else b'push') | 89 checkperm(rctx, req, b'pull' if permission == b'ro' else b'push') |
90 except hgwebcommon.ErrorResponse as e: | 90 except hgwebcommon.ErrorResponse as e: |
91 res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e)) | 91 res.status = hgwebcommon.statusmessage( |
92 e.code, stringutil.forcebytestr(e) | |
93 ) | |
92 for k, v in e.headers: | 94 for k, v in e.headers: |
93 res.headers[k] = v | 95 res.headers[k] = v |
94 res.setbodybytes(b'permission denied') | 96 res.setbodybytes(b'permission denied') |
95 return | 97 return |
96 | 98 |