diff mercurial/hgweb/hgweb_mod.py @ 36874:8ddb5c354906

hgweb: expose repo name on parsedrequest I'm not a fan of doing this because I want to find a better solution to the REPO_NAME hack. But this change gets us a few steps closer to eliminating use of wsgirequest. We can worry about fixing REPO_NAME once wsgirequest is gone. Differential Revision: https://phab.mercurial-scm.org/D2784
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 10 Mar 2018 14:06:58 -0800
parents cf69df7ea385
children 7ad6a275316f
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Sat Mar 10 14:00:40 2018 -0800
+++ b/mercurial/hgweb/hgweb_mod.py	Sat Mar 10 14:06:58 2018 -0800
@@ -141,7 +141,7 @@
             if typ in allowed or self.configbool('web', 'allow%s' % typ):
                 yield {'type': typ, 'extension': spec[2], 'node': nodeid}
 
-    def templater(self, wsgireq, req):
+    def templater(self, req):
         # determine scheme, port and server name
         # this is needed to create absolute urls
         logourl = self.config('web', 'logourl')
@@ -159,7 +159,7 @@
         # figure out which style to use
 
         vars = {}
-        styles, (style, mapfile) = getstyle(wsgireq.req, self.config,
+        styles, (style, mapfile) = getstyle(req, self.config,
                                             self.templatepath)
         if style == styles[0]:
             vars['style'] = style
@@ -168,8 +168,9 @@
 
         if not self.reponame:
             self.reponame = (self.config('web', 'name', '')
-                             or wsgireq.env.get('REPO_NAME')
-                             or req.apppath or self.repo.root)
+                             or req.reponame
+                             or req.apppath
+                             or self.repo.root)
 
         def websubfilter(text):
             return templatefilters.websub(text, self.websubtable)
@@ -372,7 +373,7 @@
         # process the web interface request
 
         try:
-            tmpl = rctx.templater(wsgireq, req)
+            tmpl = rctx.templater(req)
             ctype = tmpl('mimetype', encoding=encoding.encoding)
             ctype = templater.stringify(ctype)