comparison mercurial/hgweb/hgweb_mod.py @ 36878:89002d07a114

hgweb: remove one-off routing for file?style=raw Now that both functions are using the same API, we can unify how the command is called and perform command-specific behavior in the command itself instead of in the high-level router. Differential Revision: https://phab.mercurial-scm.org/D2788
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 10 Mar 2018 15:37:29 -0800
parents 9fc3d814646e
children 97f44b0720e2
comparison
equal deleted inserted replaced
36877:9fc3d814646e 36878:89002d07a114
397 res.headers['ETag'] = tag 397 res.headers['ETag'] = tag
398 398
399 if cmd not in webcommands.__all__: 399 if cmd not in webcommands.__all__:
400 msg = 'no such method: %s' % cmd 400 msg = 'no such method: %s' % cmd
401 raise ErrorResponse(HTTP_BAD_REQUEST, msg) 401 raise ErrorResponse(HTTP_BAD_REQUEST, msg)
402 elif cmd == 'file' and req.qsparams.get('style') == 'raw':
403 res.status = '200 Script output follows'
404 res.headers['Content-Type'] = ctype
405 content = webcommands.rawfile(rctx, wsgireq, tmpl)
406 assert content is res
407 return res.sendresponse()
408 else: 402 else:
409 # Set some globals appropriate for web handlers. Commands can 403 # Set some globals appropriate for web handlers. Commands can
410 # override easily enough. 404 # override easily enough.
411 res.status = '200 Script output follows' 405 res.status = '200 Script output follows'
412 res.headers['Content-Type'] = ctype 406 res.headers['Content-Type'] = ctype