##// END OF EJS Templates
Add MOTD display to hgweb and hgwebdir....
Colin McMillen -
r2148:c72e618c default
parent child Browse files
Show More
@@ -727,7 +727,9 b' class hgweb(object):'
727 yield self.t("header", **map)
727 yield self.t("header", **map)
728
728
729 def footer(**map):
729 def footer(**map):
730 yield self.t("footer", **map)
730 yield self.t("footer",
731 motd=self.repo.ui.config("web", "motd", ""),
732 **map)
731
733
732 def expand_form(form):
734 def expand_form(form):
733 shortcuts = {
735 shortcuts = {
@@ -1006,6 +1008,7 b' class hgwebdir(object):'
1006 def cleannames(items):
1008 def cleannames(items):
1007 return [(name.strip(os.sep), path) for name, path in items]
1009 return [(name.strip(os.sep), path) for name, path in items]
1008
1010
1011 self.motd = ""
1009 if isinstance(config, (list, tuple)):
1012 if isinstance(config, (list, tuple)):
1010 self.repos = cleannames(config)
1013 self.repos = cleannames(config)
1011 elif isinstance(config, dict):
1014 elif isinstance(config, dict):
@@ -1015,6 +1018,8 b' class hgwebdir(object):'
1015 cp = ConfigParser.SafeConfigParser()
1018 cp = ConfigParser.SafeConfigParser()
1016 cp.read(config)
1019 cp.read(config)
1017 self.repos = []
1020 self.repos = []
1021 if cp.has_section('web') and cp.has_option('web', 'motd'):
1022 self.motd = cp.get('web', 'motd')
1018 if cp.has_section('paths'):
1023 if cp.has_section('paths'):
1019 self.repos.extend(cleannames(cp.items('paths')))
1024 self.repos.extend(cleannames(cp.items('paths')))
1020 if cp.has_section('collections'):
1025 if cp.has_section('collections'):
@@ -1032,7 +1037,7 b' class hgwebdir(object):'
1032 yield tmpl("header", **map)
1037 yield tmpl("header", **map)
1033
1038
1034 def footer(**map):
1039 def footer(**map):
1035 yield tmpl("footer", **map)
1040 yield tmpl("footer", motd=self.motd, **map)
1036
1041
1037 m = os.path.join(templater.templatepath(), "map")
1042 m = os.path.join(templater.templatepath(), "map")
1038 tmpl = templater.templater(m, templater.common_filters,
1043 tmpl = templater.templater(m, templater.common_filters,
@@ -1,3 +1,4 b''
1 #motd#
1 <div class="logo">
2 <div class="logo">
2 powered by<br/>
3 powered by<br/>
3 <a href="http://www.selenic.com/mercurial/">mercurial</a>
4 <a href="http://www.selenic.com/mercurial/">mercurial</a>
General Comments 0
You need to be logged in to leave comments. Login now