This commit is contained in:
Florian Bruhin 2016-03-26 00:24:54 +01:00
parent 9edc5a665e
commit 387e35d3e5
2 changed files with 3 additions and 1 deletions

View File

@ -80,7 +80,8 @@ def render(template, **kwargs):
return _env.get_template(template).render(**kwargs)
except jinja2.exceptions.UndefinedError:
log.misc.exception("UndefinedError while rendering " + template)
err_template = utils.read_file(os.path.join('html', 'undef_error.html'))
err_path = os.path.join('html', 'undef_error.html')
err_template = utils.read_file(err_path)
tb = traceback.format_exc()
return err_template.format(pagename=template, traceback=tb)

View File

@ -34,6 +34,7 @@ from qutebrowser.utils import utils, jinja
def patch_read_file(monkeypatch):
"""pytest fixture to patch utils.read_file."""
real_read_file = utils.read_file
def _read_file(path):
"""A read_file which returns a simple template if the path is right."""
if path == os.path.join('html', 'test.html'):