Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgwebdir_mod.py @ 3488:8f02223662c8
hgweb: make #motd# available for all templates
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Sun, 22 Oct 2006 21:47:37 -0300 |
parents | bbfb392b2b1a |
children | c3043ebe40a0 |
comparison
equal
deleted
inserted
replaced
3487:46958e428fcd | 3488:8f02223662c8 |
---|---|
67 yield header_file.read() | 67 yield header_file.read() |
68 | 68 |
69 def footer(**map): | 69 def footer(**map): |
70 yield tmpl("footer", **map) | 70 yield tmpl("footer", **map) |
71 | 71 |
72 def motd(**map): | |
73 yield self.motd | |
74 | |
72 url = req.env['REQUEST_URI'].split('?')[0] | 75 url = req.env['REQUEST_URI'].split('?')[0] |
73 if not url.endswith('/'): | 76 if not url.endswith('/'): |
74 url += '/' | 77 url += '/' |
75 | 78 |
76 style = self.style | 79 style = self.style |
78 style = req.form['style'][0] | 81 style = req.form['style'][0] |
79 mapfile = style_map(templater.templatepath(), style) | 82 mapfile = style_map(templater.templatepath(), style) |
80 tmpl = templater.templater(mapfile, templater.common_filters, | 83 tmpl = templater.templater(mapfile, templater.common_filters, |
81 defaults={"header": header, | 84 defaults={"header": header, |
82 "footer": footer, | 85 "footer": footer, |
86 "motd": motd, | |
83 "url": url}) | 87 "url": url}) |
84 | 88 |
85 def archivelist(ui, nodeid, url): | 89 def archivelist(ui, nodeid, url): |
86 allowed = ui.configlist("web", "allow_archive") | 90 allowed = ui.configlist("web", "allow_archive") |
87 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: | 91 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: |
200 "%s%s" % ((not descending and column == sortcolumn) | 204 "%s%s" % ((not descending and column == sortcolumn) |
201 and "-" or "", column)) | 205 and "-" or "", column)) |
202 for column in sortable] | 206 for column in sortable] |
203 req.write(tmpl("index", entries=entries, | 207 req.write(tmpl("index", entries=entries, |
204 sortcolumn=sortcolumn, descending=descending, | 208 sortcolumn=sortcolumn, descending=descending, |
205 motd=self.motd, | |
206 **dict(sort))) | 209 **dict(sort))) |