changeset 36906:6a0e4efbc61e

hgweb: pass modern request type into templater() Only a handful of consumers of wsgirequest remaining in this file... Differential Revision: https://phab.mercurial-scm.org/D2828
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Mar 2018 15:35:03 -0700
parents 93717f082af9
children c1de7efca574
files mercurial/hgweb/hgwebdir_mod.py
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Sun Mar 11 15:37:59 2018 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sun Mar 11 15:35:03 2018 -0700
@@ -369,7 +369,7 @@
                 wsgireq.headers.append(('Content-Security-Policy', csp))
 
             virtual = req.dispatchpath.strip('/')
-            tmpl = self.templater(wsgireq, nonce)
+            tmpl = self.templater(req, nonce)
             ctype = tmpl('mimetype', encoding=encoding.encoding)
             ctype = templater.stringify(ctype)
 
@@ -485,7 +485,7 @@
 
         return res.sendresponse()
 
-    def templater(self, wsgireq, nonce):
+    def templater(self, req, nonce):
 
         def motd(**map):
             if self.motd is not None:
@@ -497,7 +497,7 @@
             return self.ui.config(section, name, default, untrusted)
 
         vars = {}
-        styles, (style, mapfile) = hgweb_mod.getstyle(wsgireq.req, config,
+        styles, (style, mapfile) = hgweb_mod.getstyle(req, config,
                                                       self.templatepath)
         if style == styles[0]:
             vars['style'] = style
@@ -506,14 +506,14 @@
         logourl = config('web', 'logourl')
         logoimg = config('web', 'logoimg')
         staticurl = (config('web', 'staticurl')
-                     or wsgireq.req.apppath + '/static/')
+                     or req.apppath + '/static/')
         if not staticurl.endswith('/'):
             staticurl += '/'
 
         defaults = {
             "encoding": encoding.encoding,
             "motd": motd,
-            "url": wsgireq.req.apppath + '/',
+            "url": req.apppath + '/',
             "logourl": logourl,
             "logoimg": logoimg,
             "staticurl": staticurl,