changeset 2500:76ff5efe8181

Fixed [web] allow_archive for comma separated parameters by using ui.configlist. Changed tests/test-archive to use allow_archive instead of the deprecated allowzip, allowgz and allowbz2.
author Thomas Arendsen Hein <thomas@intevation.de>
date Mon, 26 Jun 2006 14:56:14 +0200
parents 894435215344
children b73552a00b20
files mercurial/hgweb/hgweb_mod.py mercurial/hgweb/hgwebdir_mod.py tests/test-archive
diffstat 3 files changed, 4 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Mon Jun 26 14:52:26 2006 +0200
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Jun 26 14:56:14 2006 +0200
@@ -50,8 +50,7 @@
             self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
 
     def archivelist(self, nodeid):
-        allowed = (self.repo.ui.config("web", "allow_archive", "")
-                   .replace(",", " ").split())
+        allowed = self.repo.ui.configlist("web", "allow_archive")
         for i in self.archives:
             if i in allowed or self.repo.ui.configbool("web", "allow" + i):
                 yield {"type" : i, "node" : nodeid, "url": ""}
@@ -818,7 +817,7 @@
     def do_archive(self, req):
         changeset = self.repo.lookup(req.form['node'][0])
         type_ = req.form['type'][0]
-        allowed = self.repo.ui.config("web", "allow_archive", "").split()
+        allowed = self.repo.ui.configlist("web", "allow_archive")
         if (type_ in self.archives and (type_ in allowed or
             self.repo.ui.configbool("web", "allow" + type_, False))):
             self.archive(req, changeset, type_)
--- a/mercurial/hgweb/hgwebdir_mod.py	Mon Jun 26 14:52:26 2006 +0200
+++ b/mercurial/hgweb/hgwebdir_mod.py	Mon Jun 26 14:56:14 2006 +0200
@@ -60,8 +60,7 @@
                                              "footer": footer})
 
         def archivelist(ui, nodeid, url):
-            allowed = (ui.config("web", "allow_archive", "")
-                       .replace(",", " ").split())
+            allowed = ui.configlist("web", "allow_archive")
             for i in ['zip', 'gz', 'bz2']:
                 if i in allowed or ui.configbool("web", "allow" + i):
                     yield {"type" : i, "node": nodeid, "url": url}
--- a/tests/test-archive	Mon Jun 26 14:52:26 2006 +0200
+++ b/tests/test-archive	Mon Jun 26 14:56:14 2006 +0200
@@ -15,9 +15,7 @@
 hg commit -m 3
 echo "[web]" >> .hg/hgrc
 echo "name = test-archive" >> .hg/hgrc
-echo "allowzip = true" >> .hg/hgrc
-echo "allowgz = true" >> .hg/hgrc
-echo "allowbz2 = true" >> .hg/hgrc
+echo "allow_archive = gz bz2, zip" >> .hg/hgrc
 hg serve -p 20059 -d --pid-file=hg.pid
 
 TIP=`hg id -v | cut -f1 -d' '`