Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hgweb/common.py @ 7107:125c8fedcbe0
Allow hgweb to search for templates in more than one path.
This patch is constructed to make it easy for external extensions to
provide their own templates, by updating templater.path.
author | Brendan Cully <brendan@kublai.com> |
---|---|
date | Fri, 17 Oct 2008 11:34:31 -0700 |
parents | b84d27386285 |
children | 9c399c53469d |
line wrap: on
line diff
--- a/mercurial/hgweb/common.py Sun Oct 05 21:35:26 2008 +0200 +++ b/mercurial/hgweb/common.py Fri Oct 17 11:34:31 2008 -0700 @@ -82,10 +82,13 @@ """ locations = style and [os.path.join(style, "map"), "map-"+style] or [] locations.append("map") - for location in locations: - mapfile = os.path.join(templatepath, location) - if os.path.isfile(mapfile): - return mapfile + if isinstance(templatepath, str): + templatepath = [templatepath] + for path in templatepath: + for location in locations: + mapfile = os.path.join(path, location) + if os.path.isfile(mapfile): + return mapfile raise RuntimeError("No hgweb templates found in %r" % templatepath) def paritygen(stripecount, offset=0):