##// END OF EJS Templates
hgweb: enable reading styles from resources in frozen binaries...
Martin von Zweigbergk -
r45878:1a4f925f default
parent child Browse files
Show More
@@ -80,7 +80,7 b' def _stylemap(styles, path=None):'
80 for location in locations:
80 for location in locations:
81 mapfile, fp = templater.open_template(location, path)
81 mapfile, fp = templater.open_template(location, path)
82 if mapfile:
82 if mapfile:
83 return style, mapfile
83 return style, mapfile, fp
84
84
85 raise RuntimeError(b"No hgweb templates found in %r" % path)
85 raise RuntimeError(b"No hgweb templates found in %r" % path)
86
86
@@ -180,7 +180,9 b' class requestcontext(object):'
180 # figure out which style to use
180 # figure out which style to use
181
181
182 vars = {}
182 vars = {}
183 styles, (style, mapfile) = getstyle(req, self.config, self.templatepath)
183 styles, (style, mapfile, fp) = getstyle(
184 req, self.config, self.templatepath
185 )
184 if style == styles[0]:
186 if style == styles[0]:
185 vars[b'style'] = style
187 vars[b'style'] = style
186
188
@@ -223,10 +225,9 b' class requestcontext(object):'
223 yield self.config(b'web', b'motd')
225 yield self.config(b'web', b'motd')
224
226
225 tres = formatter.templateresources(self.repo.ui, self.repo)
227 tres = formatter.templateresources(self.repo.ui, self.repo)
226 tmpl = templater.templater.frommapfile(
228 return templater.templater.frommapfile(
227 mapfile, filters=filters, defaults=defaults, resources=tres
229 mapfile, fp=fp, filters=filters, defaults=defaults, resources=tres
228 )
230 )
229 return tmpl
230
231
231 def sendtemplate(self, name, **kwargs):
232 def sendtemplate(self, name, **kwargs):
232 """Helper function to send a response generated from a template."""
233 """Helper function to send a response generated from a template."""
@@ -542,7 +542,7 b' class hgwebdir(object):'
542 return self.ui.config(*args, **kwargs)
542 return self.ui.config(*args, **kwargs)
543
543
544 vars = {}
544 vars = {}
545 styles, (style, mapfile) = hgweb_mod.getstyle(
545 styles, (style, mapfile, fp) = hgweb_mod.getstyle(
546 req, config, self.templatepath
546 req, config, self.templatepath
547 )
547 )
548 if style == styles[0]:
548 if style == styles[0]:
@@ -577,5 +577,6 b' class hgwebdir(object):'
577 else:
577 else:
578 yield config(b'web', b'motd')
578 yield config(b'web', b'motd')
579
579
580 tmpl = templater.templater.frommapfile(mapfile, defaults=defaults)
580 return templater.templater.frommapfile(
581 return tmpl
581 mapfile, fp=fp, defaults=defaults
582 )
General Comments 0
You need to be logged in to leave comments. Login now