Mercurial > hg-stable
changeset 1964:778281d46bb2
fix template bug that made hgweb break.
problem found by Shun-ichi Goto <shunichi.goto@gmail.com>.
this fix tested with command template and hgweb templates.
author | Vadim Gelfer <vadim.gelfer@gmail.com> |
---|---|
date | Wed, 15 Mar 2006 11:28:00 -0800 |
parents | 39eb64b23cb5 |
children | 62aa1b90414f 72f7a335b955 |
files | mercurial/hgweb.py mercurial/templater.py |
diffstat | 2 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb.py Wed Mar 15 11:26:57 2006 +0100 +++ b/mercurial/hgweb.py Wed Mar 15 11:28:00 2006 -0800 @@ -797,11 +797,11 @@ or uri.strip('/') or self.repo.root) self.t = templater.templater(m, templater.common_filters, - {"url": url, - "repo": self.reponame, - "header": header, - "footer": footer, - }) + defaults={"url": url, + "repo": self.reponame, + "header": header, + "footer": footer, + }) if not req.form.has_key('cmd'): req.form['cmd'] = [self.t.cache['default'],] @@ -1030,7 +1030,8 @@ m = os.path.join(templater.templatepath(), "map") tmpl = templater.templater(m, templater.common_filters, - {"header": header, "footer": footer}) + defaults={"header": header, + "footer": footer}) def entries(**map): parity = 0
--- a/mercurial/templater.py Wed Mar 15 11:26:57 2006 +0100 +++ b/mercurial/templater.py Wed Mar 15 11:28:00 2006 -0800 @@ -59,18 +59,17 @@ filter uses function to transform value. syntax is {key|filter1|filter2|...}.''' - def __init__(self, mapfile, filters={}, cache={}): + def __init__(self, mapfile, filters={}, defaults={}, cache={}): '''set up template engine. mapfile is name of file to read map definitions from. filters is dict of functions. each transforms a value into another. defaults is dict of default map definitions.''' self.mapfile = mapfile or 'template' - self.cache = {} + self.cache = cache self.map = {} self.base = (mapfile and os.path.dirname(mapfile)) or '' self.filters = filters - self.defaults = {} - self.cache = cache + self.defaults = defaults if not mapfile: return