Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/hgweb_mod.py @ 36871:3d60a22e27f5
hgweb: perform all parameter lookup via qsparams
I think I managed to update all call sites using wsgirequest.form
to use parsedrequest.qsparams.
Since behavior of qsparams is to retrieve last value, behavior will
change if a parameter was specified multiple times. But I think this
is acceptable.
I'm not a fan of the `req.req.qsparams` pattern. And some of the
modified code could be written better. But I was aiming for a
straight port with this change. Cleanup can come later.
Differential Revision: https://phab.mercurial-scm.org/D2781
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 10 Mar 2018 12:36:36 -0800 |
parents | 4e06e8336634 |
children | cf69df7ea385 |
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py Sat Mar 10 12:11:26 2018 -0800 +++ b/mercurial/hgweb/hgweb_mod.py Sat Mar 10 12:36:36 2018 -0800 @@ -332,7 +332,7 @@ # translate user-visible url structure to internal structure args = query.split('/', 2) - if 'cmd' not in wsgireq.form and args and args[0]: + if 'cmd' not in req.qsparams and args and args[0]: cmd = args.pop(0) style = cmd.rfind('-') if style != -1: @@ -364,16 +364,16 @@ req.qsparams['style'] = 'raw' if cmd == 'archive': - fn = wsgireq.form['node'][0] + fn = req.qsparams['node'] for type_, spec in rctx.archivespecs.iteritems(): ext = spec[2] if fn.endswith(ext): wsgireq.form['node'] = [fn[:-len(ext)]] - req.qsparams['node'] = fn[:-len(next)] + req.qsparams['node'] = fn[:-len(ext)] wsgireq.form['type'] = [type_] req.qsparams['type'] = type_ else: - cmd = wsgireq.form.get('cmd', [''])[0] + cmd = req.qsparams.get('cmd', '') # process the web interface request @@ -389,7 +389,7 @@ if cmd == '': wsgireq.form['cmd'] = [tmpl.cache['default']] req.qsparams['cmd'] = tmpl.cache['default'] - cmd = wsgireq.form['cmd'][0] + cmd = req.qsparams['cmd'] # Don't enable caching if using a CSP nonce because then it wouldn't # be a nonce.