diff --git a/qutebrowser/utils/jinja.py b/qutebrowser/utils/jinja.py index 7dee80249..e6ccd9c6c 100644 --- a/qutebrowser/utils/jinja.py +++ b/qutebrowser/utils/jinja.py @@ -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) diff --git a/tests/unit/utils/test_jinja.py b/tests/unit/utils/test_jinja.py index 6852e4051..cea237d22 100644 --- a/tests/unit/utils/test_jinja.py +++ b/tests/unit/utils/test_jinja.py @@ -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'):