changeset 36910:092ab4ba7ee5

hgweb: don't pass wsgireq to makeindex and other functions We only ever access attributes that are available on our newer request type. So we no longer need this argument. Differential Revision: https://phab.mercurial-scm.org/D2826
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Mar 2018 15:29:38 -0700
parents 803e0fc0cc9a
children 93717f082af9
files mercurial/hgweb/hgwebdir_mod.py
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Sun Mar 11 15:18:29 2018 -0700
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sun Mar 11 15:29:38 2018 -0700
@@ -119,7 +119,7 @@
 
     return archives
 
-def rawindexentries(ui, repos, wsgireq, req, subdir=''):
+def rawindexentries(ui, repos, req, subdir=''):
     descend = ui.configbool('web', 'descend')
     collapse = ui.configbool('web', 'collapse')
     seenrepos = set()
@@ -161,7 +161,7 @@
                     pass
 
         parts = [
-            wsgireq.req.apppath.strip('/'),
+            req.apppath.strip('/'),
             subdir.strip('/'),
             name.strip('/'),
         ]
@@ -245,10 +245,10 @@
 
         yield row
 
-def indexentries(ui, repos, wsgireq, req, stripecount, sortcolumn='',
+def indexentries(ui, repos, req, stripecount, sortcolumn='',
                  descending=False, subdir=''):
 
-    rows = rawindexentries(ui, repos, wsgireq, req, subdir=subdir)
+    rows = rawindexentries(ui, repos, req, subdir=subdir)
 
     sortdefault = None, False
 
@@ -401,7 +401,7 @@
 
             if (not virtual or virtual == 'index') and virtual not in repos:
                 wsgireq.respond(HTTP_OK, ctype)
-                return self.makeindex(wsgireq, tmpl)
+                return self.makeindex(req, tmpl)
 
             # nested indexes and hgwebs
 
@@ -409,7 +409,7 @@
                 subdir = virtual[:-len('index')]
                 if any(r.startswith(subdir) for r in repos):
                     wsgireq.respond(HTTP_OK, ctype)
-                    return self.makeindex(wsgireq, tmpl, subdir)
+                    return self.makeindex(req, tmpl, subdir)
 
             def _virtualdirs():
                 # Check the full virtual path, each parent, and the root ('')
@@ -443,7 +443,7 @@
             subdir = virtual + '/'
             if [r for r in repos if r.startswith(subdir)]:
                 wsgireq.respond(HTTP_OK, ctype)
-                return self.makeindex(wsgireq, tmpl, subdir)
+                return self.makeindex(req, tmpl, subdir)
 
             # prefixes not found
             wsgireq.respond(HTTP_NOT_FOUND, ctype)
@@ -455,9 +455,7 @@
         finally:
             tmpl = None
 
-    def makeindex(self, wsgireq, tmpl, subdir=""):
-        req = wsgireq.req
-
+    def makeindex(self, req, tmpl, subdir=""):
         self.refresh()
         sortable = ["name", "description", "contact", "lastchange"]
         sortcolumn, descending = None, False
@@ -476,7 +474,7 @@
 
         self.refresh()
 
-        entries = indexentries(self.ui, self.repos, wsgireq, req,
+        entries = indexentries(self.ui, self.repos, req,
                                self.stripecount, sortcolumn=sortcolumn,
                                descending=descending, subdir=subdir)