comparison mercurial/hgweb/hgwebdir_mod.py @ 3326:415905fad4fe

Add base URL to hgwebdir templater (fixes index page when the URL does not have a trailing /)
author Brendan Cully <brendan@kublai.com>
date Tue, 10 Oct 2006 10:54:22 -0700
parents db9d2a624521
children cf680c9ab1dd
comparison
equal deleted inserted replaced
3325:e6353b7b102a 3326:415905fad4fe
67 yield header_file.read() 67 yield header_file.read()
68 68
69 def footer(**map): 69 def footer(**map):
70 yield tmpl("footer", motd=self.motd, **map) 70 yield tmpl("footer", motd=self.motd, **map)
71 71
72 url = req.env['REQUEST_URI'].split('?')[0]
73 if not url.endswith('/'):
74 url += '/'
75
72 style = self.style 76 style = self.style
73 if req.form.has_key('style'): 77 if req.form.has_key('style'):
74 style = req.form['style'][0] 78 style = req.form['style'][0]
75 mapfile = style_map(templater.templatepath(), style) 79 mapfile = style_map(templater.templatepath(), style)
76 tmpl = templater.templater(mapfile, templater.common_filters, 80 tmpl = templater.templater(mapfile, templater.common_filters,
77 defaults={"header": header, 81 defaults={"header": header,
78 "footer": footer}) 82 "footer": footer,
83 "url": url})
79 84
80 def archivelist(ui, nodeid, url): 85 def archivelist(ui, nodeid, url):
81 allowed = ui.configlist("web", "allow_archive") 86 allowed = ui.configlist("web", "allow_archive")
82 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: 87 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
83 if i[0] in allowed or ui.configbool("web", "allow" + i[0]): 88 if i[0] in allowed or ui.configbool("web", "allow" + i[0]):