diff options
Diffstat (limited to 'qutebrowser/browser/qutescheme.py')
-rw-r--r-- | qutebrowser/browser/qutescheme.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py index 169c92325..cb04586ff 100644 --- a/qutebrowser/browser/qutescheme.py +++ b/qutebrowser/browser/qutescheme.py @@ -40,7 +40,7 @@ import qutebrowser from qutebrowser.browser import pdfjs, downloads, history from qutebrowser.config import config, configdata, configexc from qutebrowser.utils import (version, utils, jinja, log, message, docutils, - objreg, standarddir) + resources, objreg, standarddir) from qutebrowser.qt import sip @@ -271,7 +271,7 @@ def qute_javascript(url: QUrl) -> _HandlerRet: path = url.path() if path: path = "javascript" + os.sep.join(path.split('/')) - return 'text/html', utils.read_file(path) + return 'text/html', resources.read_file(path) else: raise UrlInvalidError("No file specified") @@ -345,14 +345,14 @@ def qute_log(url: QUrl) -> _HandlerRet: @add_handler('gpl') def qute_gpl(_url: QUrl) -> _HandlerRet: """Handler for qute://gpl. Return HTML content as string.""" - return 'text/html', utils.read_file('html/license.html') + return 'text/html', resources.read_file('html/license.html') def _asciidoc_fallback_path(html_path: str) -> Optional[str]: """Fall back to plaintext asciidoc if the HTML is unavailable.""" path = html_path.replace('.html', '.asciidoc') try: - return utils.read_file(path) + return resources.read_file(path) except OSError: return None @@ -372,14 +372,14 @@ def qute_help(url: QUrl) -> _HandlerRet: path = 'html/doc/{}'.format(urlpath) if not urlpath.endswith('.html'): try: - bdata = utils.read_file_binary(path) + bdata = resources.read_file_binary(path) except OSError as e: raise SchemeOSError(e) mimetype = utils.guess_mimetype(urlpath) return mimetype, bdata try: - data = utils.read_file(path) + data = resources.read_file(path) except OSError: asciidoc = _asciidoc_fallback_path(path) @@ -575,7 +575,7 @@ def qute_resource(url: QUrl) -> _HandlerRet: path = url.path().lstrip('/') mimetype = utils.guess_mimetype(path, fallback=True) try: - data = utils.read_file_binary(path) + data = resources.read_file_binary(path) except FileNotFoundError as e: raise NotFoundError(str(e)) return mimetype, data |