comparison mercurial/hgweb/hgweb_mod.py @ 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 e10665147d26
children b73552a00b20
comparison
equal deleted inserted replaced
2499:894435215344 2500:76ff5efe8181
48 self.maxchanges = int(self.repo.ui.config("web", "maxchanges", 10)) 48 self.maxchanges = int(self.repo.ui.config("web", "maxchanges", 10))
49 self.maxfiles = int(self.repo.ui.config("web", "maxfiles", 10)) 49 self.maxfiles = int(self.repo.ui.config("web", "maxfiles", 10))
50 self.allowpull = self.repo.ui.configbool("web", "allowpull", True) 50 self.allowpull = self.repo.ui.configbool("web", "allowpull", True)
51 51
52 def archivelist(self, nodeid): 52 def archivelist(self, nodeid):
53 allowed = (self.repo.ui.config("web", "allow_archive", "") 53 allowed = self.repo.ui.configlist("web", "allow_archive")
54 .replace(",", " ").split())
55 for i in self.archives: 54 for i in self.archives:
56 if i in allowed or self.repo.ui.configbool("web", "allow" + i): 55 if i in allowed or self.repo.ui.configbool("web", "allow" + i):
57 yield {"type" : i, "node" : nodeid, "url": ""} 56 yield {"type" : i, "node" : nodeid, "url": ""}
58 57
59 def listfiles(self, files, mf): 58 def listfiles(self, files, mf):
816 req.write(z.flush()) 815 req.write(z.flush())
817 816
818 def do_archive(self, req): 817 def do_archive(self, req):
819 changeset = self.repo.lookup(req.form['node'][0]) 818 changeset = self.repo.lookup(req.form['node'][0])
820 type_ = req.form['type'][0] 819 type_ = req.form['type'][0]
821 allowed = self.repo.ui.config("web", "allow_archive", "").split() 820 allowed = self.repo.ui.configlist("web", "allow_archive")
822 if (type_ in self.archives and (type_ in allowed or 821 if (type_ in self.archives and (type_ in allowed or
823 self.repo.ui.configbool("web", "allow" + type_, False))): 822 self.repo.ui.configbool("web", "allow" + type_, False))):
824 self.archive(req, changeset, type_) 823 self.archive(req, changeset, type_)
825 return 824 return
826 825