Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgwebdir_mod.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 | 2cfdabe235fb |
children | 59b4ae211584 |
comparison
equal
deleted
inserted
replaced
7106:4674706b5b95 | 7107:125c8fedcbe0 |
---|---|
82 ctype = tmpl('mimetype', encoding=util._encoding) | 82 ctype = tmpl('mimetype', encoding=util._encoding) |
83 ctype = templater.stringify(ctype) | 83 ctype = templater.stringify(ctype) |
84 | 84 |
85 # a static file | 85 # a static file |
86 if virtual.startswith('static/') or 'static' in req.form: | 86 if virtual.startswith('static/') or 'static' in req.form: |
87 static = os.path.join(templater.templatepath(), 'static') | |
88 if virtual.startswith('static/'): | 87 if virtual.startswith('static/'): |
89 fname = virtual[7:] | 88 fname = virtual[7:] |
90 else: | 89 else: |
91 fname = req.form['static'][0] | 90 fname = req.form['static'][0] |
91 static = templater.templatepath('static') | |
92 return staticfile(static, fname, req) | 92 return staticfile(static, fname, req) |
93 | 93 |
94 # top-level index | 94 # top-level index |
95 elif not virtual: | 95 elif not virtual: |
96 req.respond(HTTP_OK, ctype) | 96 req.respond(HTTP_OK, ctype) |