Add api.config.get
This commit is contained in:
parent
1b1872e464
commit
58d179302e
@ -21,11 +21,15 @@
|
||||
|
||||
import typing
|
||||
|
||||
MYPY = False
|
||||
if MYPY:
|
||||
# pylint: disable=unused-import,useless-suppression
|
||||
from qutebrowser.config import config
|
||||
from PyQt5.QtCore import QUrl
|
||||
|
||||
from qutebrowser.config import config
|
||||
# pylint: disable=unused-import
|
||||
from qutebrowser.config.config import change_filter
|
||||
|
||||
val = typing.cast('config.ConfigContainer', None)
|
||||
|
||||
|
||||
def get(name: str, url: QUrl = None) -> typing.Any:
|
||||
"""Get a value from the config based on a string name."""
|
||||
return config.instance.get(name, url)
|
||||
|
@ -112,8 +112,8 @@ class HostBlocker:
|
||||
"""Check if the given URL (as QUrl) is blocked."""
|
||||
if first_party_url is not None and not first_party_url.isValid():
|
||||
first_party_url = None
|
||||
if not config.instance.get('content.host_blocking.enabled',
|
||||
url=first_party_url):
|
||||
if not config.get('content.host_blocking.enabled',
|
||||
url=first_party_url):
|
||||
return False
|
||||
|
||||
host = url.host()
|
||||
|
Loading…
Reference in New Issue
Block a user