Use QUrlQuery to get log level on qute://log

This helps with
https://www.riverbankcomputing.com/pipermail/pyqt/2017-November/039702.html
This commit is contained in:
Florian Bruhin 2017-11-06 08:42:59 +01:00
parent 4d8ac7486c
commit 2514b009af

View File

@ -27,7 +27,6 @@ Module attributes:
import json import json
import os import os
import time import time
import urllib.parse
import textwrap import textwrap
import mimetypes import mimetypes
@ -284,9 +283,8 @@ def qute_plainlog(url):
if log.ram_handler is None: if log.ram_handler is None:
text = "Log output was disabled." text = "Log output was disabled."
else: else:
try: level = QUrlQuery(url).queryItemValue('level')
level = urllib.parse.parse_qs(url.query())['level'][0] if not level:
except KeyError:
level = 'vdebug' level = 'vdebug'
text = log.ram_handler.dump_log(html=False, level=level) text = log.ram_handler.dump_log(html=False, level=level)
html = jinja.render('pre.html', title='log', content=text) html = jinja.render('pre.html', title='log', content=text)
@ -304,9 +302,8 @@ def qute_log(url):
if log.ram_handler is None: if log.ram_handler is None:
html_log = None html_log = None
else: else:
try: level = QUrlQuery(url).queryItemValue('level')
level = urllib.parse.parse_qs(url.query())['level'][0] if not level:
except KeyError:
level = 'vdebug' level = 'vdebug'
html_log = log.ram_handler.dump_log(html=True, level=level) html_log = log.ram_handler.dump_log(html=True, level=level)