mercurial/hgweb/hgweb_mod.py
changeset 36863 1a1972b1a1ff
parent 36861 a88d68dc3ee8
child 36864 4e06e8336634
--- a/mercurial/hgweb/hgweb_mod.py	Sat Mar 10 12:35:38 2018 -0800
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Mar 10 11:46:52 2018 -0800
@@ -53,9 +53,8 @@
 ))
 
 def getstyle(req, configfn, templatepath):
-    fromreq = req.form.get('style', [None])[0]
     styles = (
-        fromreq,
+        req.qsparams.get('style', None),
         configfn('web', 'style'),
         'paper',
     )
@@ -160,7 +159,7 @@
         # figure out which style to use
 
         vars = {}
-        styles, (style, mapfile) = getstyle(wsgireq, self.config,
+        styles, (style, mapfile) = getstyle(wsgireq.req, self.config,
                                             self.templatepath)
         if style == styles[0]:
             vars['style'] = style
@@ -337,7 +336,7 @@
             cmd = args.pop(0)
             style = cmd.rfind('-')
             if style != -1:
-                wsgireq.form['style'] = [cmd[:style]]
+                req.qsparams['style'] = cmd[:style]
                 cmd = cmd[style + 1:]
 
             # avoid accepting e.g. style parameter as command
@@ -355,7 +354,7 @@
 
             ua = req.headers.get('User-Agent', '')
             if cmd == 'rev' and 'mercurial' in ua:
-                wsgireq.form['style'] = ['raw']
+                req.qsparams['style'] = 'raw'
 
             if cmd == 'archive':
                 fn = wsgireq.form['node'][0]
@@ -389,7 +388,7 @@
             if cmd not in webcommands.__all__:
                 msg = 'no such method: %s' % cmd
                 raise ErrorResponse(HTTP_BAD_REQUEST, msg)
-            elif cmd == 'file' and 'raw' in wsgireq.form.get('style', []):
+            elif cmd == 'file' and req.qsparams.get('style') == 'raw':
                 rctx.ctype = ctype
                 content = webcommands.rawfile(rctx, wsgireq, tmpl)
             else: