changeset 37511:356e61e82c2a

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.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 01 Apr 2018 22:32:34 +0900
parents 876d54f800cf
children aac97d043e6d
files mercurial/hgweb/hgweb_mod.py mercurial/hgweb/hgwebdir_mod.py mercurial/hgweb/webutil.py
diffstat 3 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Sun Apr 01 22:20:44 2018 +0900
+++ b/mercurial/hgweb/hgweb_mod.py	Sun Apr 01 22:32:34 2018 +0900
@@ -44,12 +44,6 @@
     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 @@
         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')
--- a/mercurial/hgweb/hgwebdir_mod.py	Sun Apr 01 22:20:44 2018 +0900
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sun Apr 01 22:32:34 2018 +0900
@@ -109,7 +109,7 @@
     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({
--- a/mercurial/hgweb/webutil.py	Sun Apr 01 22:20:44 2018 +0900
+++ b/mercurial/hgweb/webutil.py	Sun Apr 01 22:32:34 2018 +0900
@@ -43,6 +43,12 @@
     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