Mercurial > hg
comparison mercurial/hgweb/webcommands.py @ 45201:86f9b25d750b
hgweb: simplify now that we always have a single path
Both `templatedir()` and `web.templatepath` are now always a single
path (or None).
Differential Revision: https://phab.mercurial-scm.org/D8788
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 21 Jul 2020 13:36:48 -0700 |
parents | 91aa9bba3dc9 |
children | 9a5c4875a88c |
comparison
equal
deleted
inserted
replaced
45200:4e9b39033d3f | 45201:86f9b25d750b |
---|---|
1318 # a repo owner may set web.static in .hg/hgrc to get any file | 1318 # a repo owner may set web.static in .hg/hgrc to get any file |
1319 # readable by the user running the CGI script | 1319 # readable by the user running the CGI script |
1320 static = web.config(b"web", b"static", untrusted=False) | 1320 static = web.config(b"web", b"static", untrusted=False) |
1321 if not static: | 1321 if not static: |
1322 tp = web.templatepath or templater.templatedir() | 1322 tp = web.templatepath or templater.templatedir() |
1323 if isinstance(tp, bytes): | 1323 static = [os.path.join(tp, b'static')] |
1324 tp = [tp] | |
1325 static = [os.path.join(p, b'static') for p in tp] | |
1326 | 1324 |
1327 staticfile(static, fname, web.res) | 1325 staticfile(static, fname, web.res) |
1328 return web.res.sendresponse() | 1326 return web.res.sendresponse() |
1329 | 1327 |
1330 | 1328 |