Patchwork D2826: hgweb: don't pass wsgireq to makeindex and other functions

login
register
mail settings
Submitter phabricator
Date March 12, 2018, 9:38 p.m.
Message ID <1a53187a35d45987942a16205046c8c8@localhost.localdomain>
Download mbox | patch
Permalink /patch/29400/
State Not Applicable
Headers show

Comments

phabricator - March 12, 2018, 9:38 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG092ab4ba7ee5: hgweb: don&#039;t pass wsgireq to makeindex and other functions (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2826?vs=6892&id=6956

REVISION DETAIL
  https://phab.mercurial-scm.org/D2826

AFFECTED FILES
  mercurial/hgweb/hgwebdir_mod.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, durin42
Cc: mercurial-devel

Patch

diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -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,15 +401,15 @@ 
 
             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
 
             if virtual.endswith('/index') and virtual not in repos:
                 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)