D2782: hgweb: remove wsgirequest.form (API)
indygreg (Gregory Szorc)
phabricator at mercurial-scm.org
Sat Mar 10 20:57:46 UTC 2018
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Now that everything is ported to consume from parsedrequest.qsparams,
we no longer have a need for wsgirequest.form. Let's remove all
references to it.
.. api::
The WSGI request object no longer exposes a ``form`` attribute
containing parsed query string data. Use the ``qsparams`` attribute
instead.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D2782
AFFECTED FILES
mercurial/hgweb/hgweb_mod.py
mercurial/hgweb/request.py
CHANGE DETAILS
diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -426,7 +426,6 @@
self.run_once = wsgienv[r'wsgi.run_once']
self.env = wsgienv
self.req = parserequestfromenv(wsgienv, inp)
- self.form = self.req.qsparams.asdictoflists()
self.res = wsgiresponse(self.req, start_response)
self._start_response = start_response
self.server_write = None
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -341,19 +341,15 @@
# avoid accepting e.g. style parameter as command
if util.safehasattr(webcommands, cmd):
- wsgireq.form['cmd'] = [cmd]
req.qsparams['cmd'] = cmd
if cmd == 'static':
- wsgireq.form['file'] = ['/'.join(args)]
req.qsparams['file'] = '/'.join(args)
else:
if args and args[0]:
node = args.pop(0).replace('%2F', '/')
- wsgireq.form['node'] = [node]
req.qsparams['node'] = node
if args:
- wsgireq.form['file'] = args
if 'file' in req.qsparams:
del req.qsparams['file']
for a in args:
@@ -368,9 +364,7 @@
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(ext)]
- wsgireq.form['type'] = [type_]
req.qsparams['type'] = type_
else:
cmd = req.qsparams.get('cmd', '')
@@ -387,7 +381,6 @@
self.check_perm(rctx, wsgireq, None)
if cmd == '':
- wsgireq.form['cmd'] = [tmpl.cache['default']]
req.qsparams['cmd'] = tmpl.cache['default']
cmd = req.qsparams['cmd']
To: indygreg, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list