Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/hgwebdir_mod.py @ 45318:1a4f925f72c3
hgweb: enable reading styles from resources in frozen binaries
All we need to do to read styles from resources is to pass the
file-like object we get from `open_template()` on to `frommapfile()`.
This takes the number of failing tests with PyOxidizer from 62 to 54.
Differential Revision: https://phab.mercurial-scm.org/D8901
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 05 Aug 2020 14:19:42 -0700 |
parents | d12fba074cc6 |
children | dc9fe90bdbd5 |
comparison
equal
deleted
inserted
replaced
45317:c37ab438ff31 | 45318:1a4f925f72c3 |
---|---|
540 def config(*args, **kwargs): | 540 def config(*args, **kwargs): |
541 kwargs.setdefault('untrusted', True) | 541 kwargs.setdefault('untrusted', True) |
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]: |
549 vars[b'style'] = style | 549 vars[b'style'] = style |
550 | 550 |
575 if self.motd is not None: | 575 if self.motd is not None: |
576 yield self.motd | 576 yield self.motd |
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 ) |