comparison mercurial/hgweb/hgwebdir_mod.py @ 4084:51e52db6b40d

hgweb: allow static files to be served directly by the HTTP server
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Thu, 15 Feb 2007 08:51:32 -0200
parents e6d26e71f049
children ca639faa38a2
comparison
equal deleted inserted replaced
4083:33c369afec94 4084:51e52db6b40d
86 86
87 url = req.env['REQUEST_URI'].split('?')[0] 87 url = req.env['REQUEST_URI'].split('?')[0]
88 if not url.endswith('/'): 88 if not url.endswith('/'):
89 url += '/' 89 url += '/'
90 90
91 staticurl = config('web', 'staticurl') or url + 'static/'
92 if not staticurl.endswith('/'):
93 staticurl += '/'
94
91 style = self.style 95 style = self.style
92 if style is None: 96 if style is None:
93 style = config('web', 'style', '') 97 style = config('web', 'style', '')
94 if req.form.has_key('style'): 98 if req.form.has_key('style'):
95 style = req.form['style'][0] 99 style = req.form['style'][0]
96 mapfile = style_map(templater.templatepath(), style) 100 mapfile = style_map(templater.templatepath(), style)
97 tmpl = templater.templater(mapfile, templater.common_filters, 101 tmpl = templater.templater(mapfile, templater.common_filters,
98 defaults={"header": header, 102 defaults={"header": header,
99 "footer": footer, 103 "footer": footer,
100 "motd": motd, 104 "motd": motd,
101 "url": url}) 105 "url": url,
106 "staticurl": staticurl})
102 107
103 def archivelist(ui, nodeid, url): 108 def archivelist(ui, nodeid, url):
104 allowed = ui.configlist("web", "allow_archive", untrusted=True) 109 allowed = ui.configlist("web", "allow_archive", untrusted=True)
105 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: 110 for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
106 if i[0] in allowed or ui.configbool("web", "allow" + i[0], 111 if i[0] in allowed or ui.configbool("web", "allow" + i[0],