##// END OF EJS Templates
fix template bug that made hgweb break....
Vadim Gelfer -
r1964:778281d4 default
parent child Browse files
Show More
@@ -797,11 +797,11 b' class hgweb(object):'
797 or uri.strip('/') or self.repo.root)
797 or uri.strip('/') or self.repo.root)
798
798
799 self.t = templater.templater(m, templater.common_filters,
799 self.t = templater.templater(m, templater.common_filters,
800 {"url": url,
800 defaults={"url": url,
801 "repo": self.reponame,
801 "repo": self.reponame,
802 "header": header,
802 "header": header,
803 "footer": footer,
803 "footer": footer,
804 })
804 })
805
805
806 if not req.form.has_key('cmd'):
806 if not req.form.has_key('cmd'):
807 req.form['cmd'] = [self.t.cache['default'],]
807 req.form['cmd'] = [self.t.cache['default'],]
@@ -1030,7 +1030,8 b' class hgwebdir(object):'
1030
1030
1031 m = os.path.join(templater.templatepath(), "map")
1031 m = os.path.join(templater.templatepath(), "map")
1032 tmpl = templater.templater(m, templater.common_filters,
1032 tmpl = templater.templater(m, templater.common_filters,
1033 {"header": header, "footer": footer})
1033 defaults={"header": header,
1034 "footer": footer})
1034
1035
1035 def entries(**map):
1036 def entries(**map):
1036 parity = 0
1037 parity = 0
@@ -59,18 +59,17 b' class templater(object):'
59 filter uses function to transform value. syntax is
59 filter uses function to transform value. syntax is
60 {key|filter1|filter2|...}.'''
60 {key|filter1|filter2|...}.'''
61
61
62 def __init__(self, mapfile, filters={}, cache={}):
62 def __init__(self, mapfile, filters={}, defaults={}, cache={}):
63 '''set up template engine.
63 '''set up template engine.
64 mapfile is name of file to read map definitions from.
64 mapfile is name of file to read map definitions from.
65 filters is dict of functions. each transforms a value into another.
65 filters is dict of functions. each transforms a value into another.
66 defaults is dict of default map definitions.'''
66 defaults is dict of default map definitions.'''
67 self.mapfile = mapfile or 'template'
67 self.mapfile = mapfile or 'template'
68 self.cache = {}
68 self.cache = cache
69 self.map = {}
69 self.map = {}
70 self.base = (mapfile and os.path.dirname(mapfile)) or ''
70 self.base = (mapfile and os.path.dirname(mapfile)) or ''
71 self.filters = filters
71 self.filters = filters
72 self.defaults = {}
72 self.defaults = defaults
73 self.cache = cache
74
73
75 if not mapfile:
74 if not mapfile:
76 return
75 return
General Comments 0
You need to be logged in to leave comments. Login now