comparison mercurial/hgweb/webcommands.py @ 7107:125c8fedcbe0

Allow hgweb to search for templates in more than one path. This patch is constructed to make it easy for external extensions to provide their own templates, by updating templater.path.
author Brendan Cully <brendan@kublai.com>
date Fri, 17 Oct 2008 11:34:31 -0700
parents 14f3ea2ea54f
children 295af5bc1bcc
comparison
equal deleted inserted replaced
7106:4674706b5b95 7107:125c8fedcbe0
564 564
565 def static(web, req, tmpl): 565 def static(web, req, tmpl):
566 fname = req.form['file'][0] 566 fname = req.form['file'][0]
567 # a repo owner may set web.static in .hg/hgrc to get any file 567 # a repo owner may set web.static in .hg/hgrc to get any file
568 # readable by the user running the CGI script 568 # readable by the user running the CGI script
569 static = web.config("web", "static", 569 static = web.config("web", "static", None, untrusted=False)
570 os.path.join(web.templatepath, "static"), 570 if not static:
571 untrusted=False) 571 tp = web.templatepath
572 if isinstance(tp, str):
573 tp = [tp]
574 for path in tp:
575 static = os.path.join(path, 'static')
576 if os.path.isdir(static):
577 break
572 return [staticfile(static, fname, req)] 578 return [staticfile(static, fname, req)]
573 579
574 def graph(web, req, tmpl): 580 def graph(web, req, tmpl):
575 rev = webutil.changectx(web.repo, req).rev() 581 rev = webutil.changectx(web.repo, req).rev()
576 bg_height = 39 582 bg_height = 39