Show More
@@ -140,11 +140,6 b' class requestcontext(object):' | |||
|
140 | 140 | if not staticurl.endswith('/'): |
|
141 | 141 | staticurl += '/' |
|
142 | 142 | |
|
143 | # some functions for the templater | |
|
144 | ||
|
145 | def motd(**map): | |
|
146 | yield self.config('web', 'motd') | |
|
147 | ||
|
148 | 143 | # figure out which style to use |
|
149 | 144 | |
|
150 | 145 | vars = {} |
@@ -177,12 +172,16 b' class requestcontext(object):' | |||
|
177 | 172 | 'urlbase': req.advertisedbaseurl, |
|
178 | 173 | 'repo': self.reponame, |
|
179 | 174 | 'encoding': encoding.encoding, |
|
180 | 'motd': motd, | |
|
181 | 175 | 'sessionvars': sessionvars, |
|
182 | 176 | 'pathdef': makebreadcrumb(req.apppath), |
|
183 | 177 | 'style': style, |
|
184 | 178 | 'nonce': self.nonce, |
|
185 | 179 | } |
|
180 | templatekeyword = registrar.templatekeyword(defaults) | |
|
181 | @templatekeyword('motd', requires=()) | |
|
182 | def motd(context, mapping): | |
|
183 | yield self.config('web', 'motd') | |
|
184 | ||
|
186 | 185 | tres = formatter.templateresources(self.repo.ui, self.repo) |
|
187 | 186 | tmpl = templater.templater.frommapfile(mapfile, |
|
188 | 187 | filters=filters, |
@@ -33,6 +33,7 b' from .. import (' | |||
|
33 | 33 | hg, |
|
34 | 34 | profiling, |
|
35 | 35 | pycompat, |
|
36 | registrar, | |
|
36 | 37 | scmutil, |
|
37 | 38 | templater, |
|
38 | 39 | templateutil, |
@@ -495,12 +496,6 b' class hgwebdir(object):' | |||
|
495 | 496 | |
|
496 | 497 | def templater(self, req, nonce): |
|
497 | 498 | |
|
498 | def motd(**map): | |
|
499 | if self.motd is not None: | |
|
500 | yield self.motd | |
|
501 | else: | |
|
502 | yield config('web', 'motd') | |
|
503 | ||
|
504 | 499 | def config(section, name, default=uimod._unset, untrusted=True): |
|
505 | 500 | return self.ui.config(section, name, default, untrusted) |
|
506 | 501 | |
@@ -520,7 +515,6 b' class hgwebdir(object):' | |||
|
520 | 515 | |
|
521 | 516 | defaults = { |
|
522 | 517 | "encoding": encoding.encoding, |
|
523 | "motd": motd, | |
|
524 | 518 | "url": req.apppath + '/', |
|
525 | 519 | "logourl": logourl, |
|
526 | 520 | "logoimg": logoimg, |
@@ -529,5 +523,13 b' class hgwebdir(object):' | |||
|
529 | 523 | "style": style, |
|
530 | 524 | "nonce": nonce, |
|
531 | 525 | } |
|
526 | templatekeyword = registrar.templatekeyword(defaults) | |
|
527 | @templatekeyword('motd', requires=()) | |
|
528 | def motd(context, mapping): | |
|
529 | if self.motd is not None: | |
|
530 | yield self.motd | |
|
531 | else: | |
|
532 | yield config('web', 'motd') | |
|
533 | ||
|
532 | 534 | tmpl = templater.templater.frommapfile(mapfile, defaults=defaults) |
|
533 | 535 | return tmpl |
General Comments 0
You need to be logged in to leave comments.
Login now