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