changeset 18191:e4f17956f45a stable

hgwebdir: honor web.templates and web.static for static files (issue3734)
author Matt Mackall <mpm@selenic.com>
date Sat, 22 Dec 2012 18:11:51 -0600
parents 52581d2b98ac
children f9a89bdd64a6
files mercurial/hgweb/hgwebdir_mod.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgwebdir_mod.py	Fri Dec 28 14:10:35 2012 +0100
+++ b/mercurial/hgweb/hgwebdir_mod.py	Sat Dec 22 18:11:51 2012 -0600
@@ -184,7 +184,13 @@
                         fname = virtual[7:]
                     else:
                         fname = req.form['static'][0]
-                    static = templater.templatepath('static')
+                    static = self.ui.config("web", "static", None,
+                                            untrusted=False)
+                    if not static:
+                        tp = self.templatepath or templater.templatepath()
+                        if isinstance(tp, str):
+                            tp = [tp]
+                        static = [os.path.join(p, 'static') for p in tp]
                     return (staticfile(static, fname, req),)
 
                 # top-level index