diff --git a/qutebrowser/network/qutescheme.py b/qutebrowser/network/qutescheme.py index e24c9b4ea..34fa86a86 100644 --- a/qutebrowser/network/qutescheme.py +++ b/qutebrowser/network/qutescheme.py @@ -24,7 +24,7 @@ Module attributes: pyeval_output: The output of the last :pyeval command. """ -import html +import html as pyhtml from PyQt5.QtNetwork import QNetworkReply @@ -112,13 +112,13 @@ class QuteHandlers: @classmethod def pyeval(cls): """Handler for qute:pyeval. Return HTML content as bytes.""" - text = html.escape(pyeval_output) + text = pyhtml.escape(pyeval_output) return _get_html('pyeval', '
{}
'.format(text)) @classmethod def version(cls): """Handler for qute:version. Return HTML content as bytes.""" - text = html.escape(version.version()) + text = pyhtml.escape(version.version()) html = '

Version info

' html += '

{}

'.format(text.replace('\n', '
')) html += '

Copyright info

' @@ -132,7 +132,7 @@ class QuteHandlers: if logutils.ram_handler is None: text = "Log output was disabled." else: - text = html.escape(logutils.ram_handler.dump_log()) + text = pyhtml.escape(logutils.ram_handler.dump_log()) return _get_html('log', '
{}
'.format(text)) @classmethod diff --git a/qutebrowser/test/config/test_conftypes.py b/qutebrowser/test/config/test_conftypes.py index b1a479a4a..f9ffd6f30 100644 --- a/qutebrowser/test/config/test_conftypes.py +++ b/qutebrowser/test/config/test_conftypes.py @@ -1139,12 +1139,12 @@ class FontTests(unittest.TestCase): def test_transform(self): """Test transform.""" for string, desc in self.TESTS.items(): - with self.subTest(val=val): + with self.subTest(string=string, desc=desc): with self.subTest(t="t1"): self.assertEqual(self.t.transform(string), string, string) with self.subTest(t="t2"): self.assertEqual(Font(self.t2.transform(string)), - Font.fromdesc(desc), string) + Font.fromdesc(desc), string) def test_transform_empty(self): """Test transform with an empty value.""" diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index a30700840..6cb61e39c 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -22,7 +22,7 @@ import re import os import sys -import html +import html as pyhtml import logging from contextlib import contextmanager from logging import getLogger @@ -383,7 +383,7 @@ class HTMLFormatter(logging.Formatter): for field in ['msg', 'filename', 'funcName', 'levelname', 'module', 'name', 'pathname', 'processName', 'threadName']: data = str(getattr(record, field)) - setattr(record, field, html.escape(data)) + setattr(record, field, pyhtml.escape(data)) message = super().format(record) if not message.endswith(self._colordict['reset']): message += self._colordict['reset'] @@ -391,4 +391,4 @@ class HTMLFormatter(logging.Formatter): def formatTime(self, record, datefmt=None): out = super().formatTime(record, datefmt) - return html.escape(out) + return pyhtml.escape(out)