D2813: hgweb: move archivelist to standalone function

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Mar 12 17:35:09 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG04af43e0a997: hgweb: move archivelist to standalone function (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2813?vs=6879&id=6943

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

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
@@ -132,6 +132,22 @@
 
     return False
 
+def archivelist(ui, nodeid, url):
+    allowed = ui.configlist('web', 'allow_archive', untrusted=True)
+    archives = []
+
+    for typ, spec in hgweb_mod.archivespecs.iteritems():
+        if typ in allowed or ui.configbool('web', 'allow' + typ,
+                                           untrusted=True):
+            archives.append({
+                'type': typ,
+                'extension': spec[2],
+                'node': nodeid,
+                'url': url,
+            })
+
+    return archives
+
 class hgwebdir(object):
     """HTTP server for multiple repositories.
 
@@ -331,16 +347,6 @@
     def makeindex(self, wsgireq, tmpl, subdir=""):
         req = wsgireq.req
 
-        def archivelist(ui, nodeid, url):
-            allowed = ui.configlist("web", "allow_archive", untrusted=True)
-            archives = []
-            for typ, spec in hgweb_mod.archivespecs.iteritems():
-                if typ in allowed or ui.configbool("web", "allow" + typ,
-                                                    untrusted=True):
-                    archives.append({"type": typ, "extension": spec[2],
-                                     "node": nodeid, "url": url})
-            return archives
-
         def rawentries(subdir="", **map):
 
             descend = self.ui.configbool('web', 'descend')



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


More information about the Mercurial-devel mailing list