Mercurial > hg-stable
changeset 4080:ef14fdb675da
hgwebdir: try to get web.style and web.motd from the ui.config system
This finishes fixing issue253. As a bonus, web.style and web.motd
settings from ~/.hgrc will be used for the hgwebdir index page.
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Tue, 13 Feb 2007 10:02:07 -0200 |
parents | 40c9710e8182 |
children | e6d26e71f049 cc8a52229620 |
files | mercurial/hgweb/hgwebdir_mod.py |
diffstat | 1 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py Tue Feb 13 10:01:44 2007 -0200 +++ b/mercurial/hgweb/hgwebdir_mod.py Tue Feb 13 10:02:07 2007 -0200 @@ -21,8 +21,8 @@ return [(name.strip(os.sep), path) for name, path in items] self.parentui = parentui - self.motd = "" - self.style = "" + self.motd = None + self.style = None self.repos_sorted = ('name', False) if isinstance(config, (list, tuple)): self.repos = cleannames(config) @@ -72,15 +72,23 @@ yield tmpl("footer", **map) def motd(**map): - yield self.motd + if self.motd is not None: + yield self.motd + else: + yield config('web', 'motd', '') parentui = self.parentui or ui.ui(report_untrusted=False) + def config(section, name, default=None, untrusted=True): + return parentui.config(section, name, default, untrusted) + url = req.env['REQUEST_URI'].split('?')[0] if not url.endswith('/'): url += '/' style = self.style + if style is None: + style = config('web', 'style', '') if req.form.has_key('style'): style = req.form['style'][0] mapfile = style_map(templater.templatepath(), style)