##// END OF EJS Templates
hgweb: rely on open_template()'s fallback to using templatedir()...
Martin von Zweigbergk -
r45877:c37ab438 default
parent child Browse files
Show More
@@ -65,26 +65,22 b' def _stylemap(styles, path=None):'
65 3. templatepath/map
65 3. templatepath/map
66 """
66 """
67
67
68 if path is None:
68 for style in styles:
69 path = templater.templatedir()
69 # only plain name is allowed to honor template paths
70 if (
71 not style
72 or style in (pycompat.oscurdir, pycompat.ospardir)
73 or pycompat.ossep in style
74 or pycompat.osaltsep
75 and pycompat.osaltsep in style
76 ):
77 continue
78 locations = (os.path.join(style, b'map'), b'map-' + style, b'map')
70
79
71 if path is not None:
80 for location in locations:
72 for style in styles:
81 mapfile, fp = templater.open_template(location, path)
73 # only plain name is allowed to honor template paths
82 if mapfile:
74 if (
83 return style, mapfile
75 not style
76 or style in (pycompat.oscurdir, pycompat.ospardir)
77 or pycompat.ossep in style
78 or pycompat.osaltsep
79 and pycompat.osaltsep in style
80 ):
81 continue
82 locations = (os.path.join(style, b'map'), b'map-' + style, b'map')
83
84 for location in locations:
85 mapfile, fp = templater.open_template(location, path)
86 if mapfile:
87 return style, mapfile
88
84
89 raise RuntimeError(b"No hgweb templates found in %r" % path)
85 raise RuntimeError(b"No hgweb templates found in %r" % path)
90
86
General Comments 0
You need to be logged in to leave comments. Login now