This means:
- An annotation like (int, str) is now typing.Union[int, str].
- utils.typing got expanded so it acts like the real typing.py, with
issubclass() working properly with typing.Union and __union_params__
being set.
- A literal string doesn't exist anymore as annotation, instead
@cmdutils.argument now has a 'choices' argument which can be used like
@cmdutils.argument('arg', choices=['val1', 'val2']).
- Argument validating/converting is now entirely handled by
argparser.type_conv instead of relying on python's argparse, i.e.
type/choices is now not passed to argparse anymore.
This failed because dict.get('level') returned None with no level
parameter, and the subsequent [0] raised:
Traceback (most recent call last):
File ".../qutebrowser/utils/utils.py", line 624, in wrapper
return func(*args, **kwargs)
File ".../qutebrowser/browser/network/networkmanager.py", line 445, in createRequest
op, req, outgoing_data)
File ".../qutebrowser/browser/network/qutescheme.py", line 107, in createRequest
data = handler(self._win_id, request)
File ".../qutebrowser/browser/network/qutescheme.py", line 189, in qute_log
level = urllib.parse.parse_qs(request.url().query()).get('level')[0]
TypeError: 'NoneType' object is not subscriptable
- Add log.LOG_LEVELS to map names to levels (instead of using
logging._levelToName)
- Test that log pages do not contain messages below the requested level
- Use pythons urllib.parse.parse_qs instead of Qt's UrlQuery
- Document tab, bg, window args for :messages
- Clean up style
This adds a 'level' query parameter to qute://log and qute://plainlog.
For example, qute://log?level=warning will show an html page containing
log entries with severity warning or greater.
If the query is omitted, the original behavior of qute://log is
preserved.
:messages [level] is a command that opens qute://log?level=<level>.
By default, level defaults to 'error' as an easy way to see missed
error messages.
An unique keybinding for each test means we have some level of
isolation and can understand error messages more easily.
As we're >10 now, let's use a leading zero to avoid shadowed
keybindings.
Issue 1413
This happens when the networkmanager is used by something that has no
tab_id, like the generic DownloadManager. In this case, we should just
skip the webview connection (as it makes no sense) instead of crashing
(which is the last thing we want to do).
The <command> arg is now optional. If omitted, :bind prints the current
binding as a message. If --mode is given, the binding for that mode is
printed.
--cachedir="" doesn't work because the quotes are not processed (as they
would be by the shell) and the cachedir is set to ./"" (that is a
directory with two double quotes as name). The correct start parameter
is thus --cachedir=, which correctly fails when the fix is reverted.
When using :tab-prev/:tab-next (or :tab-focus which uses :tab-next
internally) immediately after the last tab, those functions could be
called with 0 tabs open, which caused a ZeroDivisionError when trying to
do % 0.
Fixes#1448.