Mercurial > hg-stable
changeset 3262:1e322b44b366
Teach hgwebdir about new interface
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Wed, 04 Oct 2006 17:04:40 -0700 |
parents | 329ac0c0c0e8 |
children | 3207e30bf468 |
files | mercurial/hgweb/hgwebdir_mod.py |
diffstat | 1 files changed, 14 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py Wed Oct 04 17:04:40 2006 -0700 +++ b/mercurial/hgweb/hgwebdir_mod.py Wed Oct 04 17:04:40 2006 -0700 @@ -85,9 +85,10 @@ def archivelist(ui, nodeid, url): 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} + for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: + if i[0] in allowed or ui.configbool("web", "allow" + i[0]): + yield {"type" : i[0], "extension": i[1], + "node": nodeid, "url": url} def entries(sortcolumn="", descending=False, **map): rows = [] @@ -101,7 +102,7 @@ get = u.config url = ('/'.join([req.env["REQUEST_URI"].split('?')[0], name]) - .replace("//", "/")) + .replace("//", "/")) + '/' # update time with local timezone try: @@ -143,8 +144,16 @@ virtual = req.env.get("PATH_INFO", "").strip('/') if virtual: - real = dict(self.repos).get(virtual) + while virtual: + real = dict(self.repos).get(virtual) + if real: + break + up = virtual.rfind('/') + if up < 0: + break + virtual = virtual[:up] if real: + req.env['REPO_NAME'] = virtual try: hgweb(real).run_wsgi(req) except IOError, inst: