# HG changeset patch # User Yuya Nishihara <y...@tcha.org> # Date 1522589554 -32400 # Sun Apr 01 22:32:34 2018 +0900 # Node ID 1dd6d286577ee108d2b643f320bf22e72823b47d # Parent 411dfde85bce520eb637ea52bce93e336b9e9a30 hgweb: move archivespecs to webutil
Move one step further from e38e7ea21987. Since 'archivespecs' is a constant shared with hgweb and hgwebdir, webutil is a better place to define it. diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py --- a/mercurial/hgweb/hgweb_mod.py +++ b/mercurial/hgweb/hgweb_mod.py @@ -44,12 +44,6 @@ from . import ( wsgicgi, ) -archivespecs = util.sortdict(( - ('zip', ('application/zip', 'zip', '.zip', None)), - ('gz', ('application/x-gzip', 'tgz', '.tar.gz', None)), - ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)), -)) - def getstyle(req, configfn, templatepath): styles = ( req.qsparams.get('style', None), @@ -96,7 +90,7 @@ class requestcontext(object): self.req = req self.res = res - self.archivespecs = archivespecs + self.archivespecs = webutil.archivespecs self.maxchanges = self.configint('web', 'maxchanges') self.stripecount = self.configint('web', 'stripes') 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 @@ -109,7 +109,7 @@ def archivelist(ui, nodeid, url): allowed = ui.configlist('web', 'allow_archive', untrusted=True) archives = [] - for typ, spec in hgweb_mod.archivespecs.iteritems(): + for typ, spec in webutil.archivespecs.iteritems(): if typ in allowed or ui.configbool('web', 'allow' + typ, untrusted=True): archives.append({ diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -43,6 +43,12 @@ from ..utils import ( stringutil, ) +archivespecs = util.sortdict(( + ('zip', ('application/zip', 'zip', '.zip', None)), + ('gz', ('application/x-gzip', 'tgz', '.tar.gz', None)), + ('bz2', ('application/x-bzip2', 'tbz2', '.tar.bz2', None)), +)) + def up(p): if p[0:1] != "/": p = "/" + p _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel