comparison mercurial/hgweb/hgwebdir_mod.py @ 9903:5d748045c2ae stable

Do not overwrite motd attribute of hgwebdir instances on refresh. This allows using application = hgwebdir(...) application.motd = (string or object with __str__ method) in WSGI (like it is possible in CGI). Changed web.motd in the config file is still read with this, because hgwebdir.templater.motd() does not store the config value.
author Thomas Arendsen Hein <thomas@intevation.de>
date Sun, 22 Nov 2009 11:25:01 +0100
parents d3dbdca92458
children 97c75ad3b1a0 25e572394f5c
comparison
equal deleted inserted replaced
9900:8939900073a8 9903:5d748045c2ae
46 46
47 def __init__(self, conf, baseui=None): 47 def __init__(self, conf, baseui=None):
48 self.conf = conf 48 self.conf = conf
49 self.baseui = baseui 49 self.baseui = baseui
50 self.lastrefresh = 0 50 self.lastrefresh = 0
51 self.motd = None
51 self.refresh() 52 self.refresh()
52 53
53 def refresh(self): 54 def refresh(self):
54 if self.lastrefresh + self.refreshinterval > time.time(): 55 if self.lastrefresh + self.refreshinterval > time.time():
55 return 56 return
70 elif isinstance(self.conf, dict): 71 elif isinstance(self.conf, dict):
71 paths = self.conf.items() 72 paths = self.conf.items()
72 73
73 encoding.encoding = self.ui.config('web', 'encoding', 74 encoding.encoding = self.ui.config('web', 'encoding',
74 encoding.encoding) 75 encoding.encoding)
75 self.motd = self.ui.config('web', 'motd')
76 self.style = self.ui.config('web', 'style', 'paper') 76 self.style = self.ui.config('web', 'style', 'paper')
77 self.stripecount = self.ui.config('web', 'stripes', 1) 77 self.stripecount = self.ui.config('web', 'stripes', 1)
78 if self.stripecount: 78 if self.stripecount:
79 self.stripecount = int(self.stripecount) 79 self.stripecount = int(self.stripecount)
80 self._baseurl = self.ui.config('web', 'baseurl') 80 self._baseurl = self.ui.config('web', 'baseurl')