comparison tests/hgweberror.py @ 40155:0199fb5dde20

py3: byteify hgweberror.py # skip-blame just b'' prefixes Differential Revision: https://phab.mercurial-scm.org/D4966
author Gregory Szorc <gregory.szorc@gmail.com>
date Thu, 11 Oct 2018 21:22:43 +0200
parents 4daa22071d5d
children 2372284d9457
comparison
equal deleted inserted replaced
40154:fe11fc7e541f 40155:0199fb5dde20
8 8
9 def raiseerror(web): 9 def raiseerror(web):
10 '''Dummy web command that raises an uncaught Exception.''' 10 '''Dummy web command that raises an uncaught Exception.'''
11 11
12 # Simulate an error after partial response. 12 # Simulate an error after partial response.
13 if 'partialresponse' in web.req.qsparams: 13 if b'partialresponse' in web.req.qsparams:
14 web.res.status = b'200 Script output follows' 14 web.res.status = b'200 Script output follows'
15 web.res.headers[b'Content-Type'] = b'text/plain' 15 web.res.headers[b'Content-Type'] = b'text/plain'
16 web.res.setbodywillwrite() 16 web.res.setbodywillwrite()
17 list(web.res.sendresponse()) 17 list(web.res.sendresponse())
18 web.res.getbodyfile().write(b'partial content\n') 18 web.res.getbodyfile().write(b'partial content\n')
19 19
20 raise AttributeError('I am an uncaught error!') 20 raise AttributeError('I am an uncaught error!')
21 21
22 def extsetup(ui): 22 def extsetup(ui):
23 setattr(webcommands, 'raiseerror', raiseerror) 23 setattr(webcommands, 'raiseerror', raiseerror)
24 webcommands.__all__.append('raiseerror') 24 webcommands.__all__.append(b'raiseerror')