[Updated] D8900: hgweb: rely on open_template()'s fallback to using templatedir()
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Thu Aug 6 00:49:44 UTC 2020
Closed by commit rHGc37ab438ff31: hgweb: rely on open_template()'s fallback to using templatedir() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8900?vs=22282&id=22297
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8900/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8900
AFFECTED FILES
mercurial/hgweb/hgweb_mod.py
CHANGE DETAILS
diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py
+++ b/mercurial/hgweb/hgweb_mod.py
@@ -65,26 +65,22 @@
3. templatepath/map
"""
- if path is None:
- path = templater.templatedir()
+ for style in styles:
+ # only plain name is allowed to honor template paths
+ if (
+ not style
+ or style in (pycompat.oscurdir, pycompat.ospardir)
+ or pycompat.ossep in style
+ or pycompat.osaltsep
+ and pycompat.osaltsep in style
+ ):
+ continue
+ locations = (os.path.join(style, b'map'), b'map-' + style, b'map')
- if path is not None:
- for style in styles:
- # only plain name is allowed to honor template paths
- if (
- not style
- or style in (pycompat.oscurdir, pycompat.ospardir)
- or pycompat.ossep in style
- or pycompat.osaltsep
- and pycompat.osaltsep in style
- ):
- continue
- locations = (os.path.join(style, b'map'), b'map-' + style, b'map')
-
- for location in locations:
- mapfile, fp = templater.open_template(location, path)
- if mapfile:
- return style, mapfile
+ for location in locations:
+ mapfile, fp = templater.open_template(location, path)
+ if mapfile:
+ return style, mapfile
raise RuntimeError(b"No hgweb templates found in %r" % path)
To: martinvonz, #hg-reviewers, indygreg
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200806/a0f8a53a/attachment-0002.html>
More information about the Mercurial-patches
mailing list