# HG changeset patch # User Brendan Cully # Date 1225257857 25200 # Node ID 9c399c53469d7091c0ab338c826e15f2bc25c0b7 # Parent 6e9fe4ff9c5499a7b8354337a622562f2d4312d9 Allow per-file shadowing of static directory in templatepath diff -r 6e9fe4ff9c54 -r 9c399c53469d mercurial/hgweb/common.py --- a/mercurial/hgweb/common.py Tue Oct 28 21:58:30 2008 -0700 +++ b/mercurial/hgweb/common.py Tue Oct 28 22:24:17 2008 -0700 @@ -53,12 +53,17 @@ """ parts = fname.split('/') - path = directory for part in parts: if (part in ('', os.curdir, os.pardir) or os.sep in part or os.altsep is not None and os.altsep in part): return "" - path = os.path.join(path, part) + fpath = os.path.join(*parts) + if isinstance(directory, str): + directory = [directory] + for d in directory: + path = os.path.join(d, fpath) + if os.path.exists(path): + break try: os.stat(path) ct = mimetypes.guess_type(path)[0] or "text/plain" diff -r 6e9fe4ff9c54 -r 9c399c53469d mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py Tue Oct 28 21:58:30 2008 -0700 +++ b/mercurial/hgweb/webcommands.py Tue Oct 28 22:24:17 2008 -0700 @@ -583,10 +583,7 @@ tp = web.templatepath if isinstance(tp, str): tp = [tp] - for path in tp: - static = os.path.join(path, 'static') - if os.path.isdir(static): - break + static = [os.path.join(p, 'static') for p in tp] return [staticfile(static, fname, req)] def graph(web, req, tmpl):