# HG changeset patch # User Gregory Szorc # Date 1520788678 25200 # Node ID 04af43e0a997a91838b58ebb19add51d4d55485d # Parent f8d6d9b29b393dc94ac327f27da0a21fde6cfd51 hgweb: move archivelist to standalone function This doesn't need to exist as an inline function in a method. Minor formatting changes were made as part of the move. Differential Revision: https://phab.mercurial-scm.org/D2813 diff -r f8d6d9b29b39 -r 04af43e0a997 mercurial/hgweb/hgwebdir_mod.py --- a/mercurial/hgweb/hgwebdir_mod.py Sun Mar 11 10:15:33 2018 -0700 +++ b/mercurial/hgweb/hgwebdir_mod.py Sun Mar 11 10:17:58 2018 -0700 @@ -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')