D2826: hgweb: don't pass wsgireq to makeindex and other functions
This revision was automatically updated to reflect the committed changes. Closed by commit rHG092ab4ba7ee5: hgweb: dont 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=6956 REVISION DETAIL https://phab.mercurial-scm.org/D2826 AFFECTED FILES mercurial/hgweb/hgwebdir_mod.py CHANGE DETAILS 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) To: indygreg, #hg-reviewers, durin42 Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D2826: hgweb: don't pass wsgireq to makeindex and other functions
indygreg created this revision. Herald added a subscriber: mercurial-devel. Herald added a reviewer: hg-reviewers. REVISION SUMMARY We only ever access attributes that are available on our newer request type. So we no longer need this argument. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D2826 AFFECTED FILES mercurial/hgweb/hgwebdir_mod.py CHANGE DETAILS 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) To: indygreg, #hg-reviewers Cc: mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel