Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/webcommands.py @ 45235:91aa9bba3dc9
templater: make templatepaths() return a single path, or None
The function returns either a singleton list or an empty list, so it
makes more sense to return a value or None. The plural in the name
also doesn't make sense, but `templatepath()` is already taken, so I
renamed it to `templatedir()` instead.
Differential Revision: https://phab.mercurial-scm.org/D8786
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 21 Jul 2020 13:11:49 -0700 |
parents | 3e4294aa7944 |
children | 86f9b25d750b |
comparison
equal
deleted
inserted
replaced
45234:e2ec36167151 | 45235:91aa9bba3dc9 |
---|---|
1317 fname = web.req.qsparams[b'file'] | 1317 fname = web.req.qsparams[b'file'] |
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.templatepaths() | 1322 tp = web.templatepath or templater.templatedir() |
1323 if isinstance(tp, bytes): | 1323 if isinstance(tp, bytes): |
1324 tp = [tp] | 1324 tp = [tp] |
1325 static = [os.path.join(p, b'static') for p in tp] | 1325 static = [os.path.join(p, b'static') for p in tp] |
1326 | 1326 |
1327 staticfile(static, fname, web.res) | 1327 staticfile(static, fname, web.res) |