##// END OF EJS Templates
hgweb: some cleanups in hgwebdir, remove double defaults...
Dirkjan Ochtman -
r8215:227707c9 default
parent child Browse files
Show More
@@ -15,15 +15,15 b' from common import ErrorResponse, get_mt'
15 from hgweb_mod import hgweb
15 from hgweb_mod import hgweb
16 from request import wsgirequest
16 from request import wsgirequest
17
17
18 # This is a stopgap
18 def cleannames(items):
19 return [(util.pconvert(name).strip('/'), path) for name, path in items]
20
19 class hgwebdir(object):
21 class hgwebdir(object):
22
20 def __init__(self, conf, baseui=None):
23 def __init__(self, conf, baseui=None):
21 def cleannames(items):
22 return [(util.pconvert(name).strip('/'), path)
23 for name, path in items]
24
24
25 if baseui:
25 if baseui:
26 self.ui = baseui.copy()
26 self.ui = baseui.copy()
27 else:
27 else:
28 self.ui = ui.ui()
28 self.ui = ui.ui()
29 self.ui.setconfig('ui', 'report_untrusted', 'off')
29 self.ui.setconfig('ui', 'report_untrusted', 'off')
@@ -31,9 +31,10 b' class hgwebdir(object):'
31
31
32 self.motd = None
32 self.motd = None
33 self.style = 'paper'
33 self.style = 'paper'
34 self.stripecount = None
34 self.stripecount = 1
35 self.repos_sorted = ('name', False)
35 self.repos_sorted = ('name', False)
36 self._baseurl = None
36 self._baseurl = None
37
37 if isinstance(conf, (list, tuple)):
38 if isinstance(conf, (list, tuple)):
38 self.repos = cleannames(conf)
39 self.repos = cleannames(conf)
39 self.repos_sorted = ('', False)
40 self.repos_sorted = ('', False)
@@ -48,7 +49,7 b' class hgwebdir(object):'
48 self.repos = []
49 self.repos = []
49 self.motd = cp.get('web', 'motd')
50 self.motd = cp.get('web', 'motd')
50 self.style = cp.get('web', 'style', 'paper')
51 self.style = cp.get('web', 'style', 'paper')
51 self.stripecount = cp.get('web', 'stripes')
52 self.stripecount = cp.get('web', 'stripes', 1)
52 self._baseurl = cp.get('web', 'baseurl')
53 self._baseurl = cp.get('web', 'baseurl')
53 if 'paths' in cp:
54 if 'paths' in cp:
54 paths = cleannames(cp.items('paths'))
55 paths = cleannames(cp.items('paths'))
@@ -310,12 +311,7 b' class hgwebdir(object):'
310 if not staticurl.endswith('/'):
311 if not staticurl.endswith('/'):
311 staticurl += '/'
312 staticurl += '/'
312
313
313 style = self.style
314 style = 'style' in req.form and req.form['style'][0] or self.style
314 if style is None:
315 style = config('web', 'style', '')
316 if 'style' in req.form:
317 style = req.form['style'][0]
318 self.stripecount = int(self.stripecount or config('web', 'stripes', 1))
319 mapfile = templater.stylemap(style)
315 mapfile = templater.stylemap(style)
320 tmpl = templater.templater(mapfile, templatefilters.filters,
316 tmpl = templater.templater(mapfile, templatefilters.filters,
321 defaults={"header": header,
317 defaults={"header": header,
General Comments 0
You need to be logged in to leave comments. Login now