- skip-blame just b'' prefixes
Details
Details
- Reviewers
pulkit - Group Reviewers
hg-reviewers - Commits
- rHG0199fb5dde20: py3: byteify hgweberror.py
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
| pulkit |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| # A dummy extension that installs an hgweb command that throws an Exception. | # A dummy extension that installs an hgweb command that throws an Exception. | ||||
| from __future__ import absolute_import | from __future__ import absolute_import | ||||
| from mercurial.hgweb import ( | from mercurial.hgweb import ( | ||||
| webcommands, | webcommands, | ||||
| ) | ) | ||||
| def raiseerror(web): | def raiseerror(web): | ||||
| '''Dummy web command that raises an uncaught Exception.''' | '''Dummy web command that raises an uncaught Exception.''' | ||||
| # Simulate an error after partial response. | # Simulate an error after partial response. | ||||
| if 'partialresponse' in web.req.qsparams: | if b'partialresponse' in web.req.qsparams: | ||||
| web.res.status = b'200 Script output follows' | web.res.status = b'200 Script output follows' | ||||
| web.res.headers[b'Content-Type'] = b'text/plain' | web.res.headers[b'Content-Type'] = b'text/plain' | ||||
| web.res.setbodywillwrite() | web.res.setbodywillwrite() | ||||
| list(web.res.sendresponse()) | list(web.res.sendresponse()) | ||||
| web.res.getbodyfile().write(b'partial content\n') | web.res.getbodyfile().write(b'partial content\n') | ||||
| raise AttributeError('I am an uncaught error!') | raise AttributeError('I am an uncaught error!') | ||||
| def extsetup(ui): | def extsetup(ui): | ||||
| setattr(webcommands, 'raiseerror', raiseerror) | setattr(webcommands, 'raiseerror', raiseerror) | ||||
| webcommands.__all__.append('raiseerror') | webcommands.__all__.append(b'raiseerror') | ||||