From 2514b009af566f2bb90f9cd45e22676098f91873 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 6 Nov 2017 08:42:59 +0100 Subject: [PATCH] Use QUrlQuery to get log level on qute://log This helps with https://www.riverbankcomputing.com/pipermail/pyqt/2017-November/039702.html --- qutebrowser/browser/qutescheme.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/qutebrowser/browser/qutescheme.py b/qutebrowser/browser/qutescheme.py index 0c4f611f5..220bb1beb 100644 --- a/qutebrowser/browser/qutescheme.py +++ b/qutebrowser/browser/qutescheme.py @@ -27,7 +27,6 @@ Module attributes: import json import os import time -import urllib.parse import textwrap import mimetypes @@ -284,9 +283,8 @@ def qute_plainlog(url): if log.ram_handler is None: text = "Log output was disabled." else: - try: - level = urllib.parse.parse_qs(url.query())['level'][0] - except KeyError: + level = QUrlQuery(url).queryItemValue('level') + if not level: level = 'vdebug' text = log.ram_handler.dump_log(html=False, level=level) html = jinja.render('pre.html', title='log', content=text) @@ -304,9 +302,8 @@ def qute_log(url): if log.ram_handler is None: html_log = None else: - try: - level = urllib.parse.parse_qs(url.query())['level'][0] - except KeyError: + level = QUrlQuery(url).queryItemValue('level') + if not level: level = 'vdebug' html_log = log.ram_handler.dump_log(html=True, level=level)