From c3d8f6667309c3968b6678d883889a157b3a80b3 Mon Sep 17 00:00:00 2001 From: Ellis Date: Tue, 18 Sep 2018 13:17:02 -0400 Subject: [PATCH] Renamed is_whitelisted_host to is_whitelisted_url, removed unused try block --- qutebrowser/browser/adblock.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/qutebrowser/browser/adblock.py b/qutebrowser/browser/adblock.py index 8c8a544bf..d0967ac8e 100644 --- a/qutebrowser/browser/adblock.py +++ b/qutebrowser/browser/adblock.py @@ -60,18 +60,15 @@ def get_fileobj(byte_io): return byte_io -def is_whitelisted_host(url): +def is_whitelisted_url(url): """Check if the given url is on the adblock whitelist. Args: url: The url to check in QUrl form. """ for pattern in config.val.content.host_blocking.whitelist: - try: - if pattern.matches(url): - return True - except urlmatch.ParseError: - log.misc.exception("Unable to read UrlPattern: " + str(url)) + if pattern.matches(url): + return True return False @@ -120,7 +117,7 @@ class HostBlocker: host = url.host() return ((host in self._blocked_hosts or host in self._config_blocked_hosts) and - not is_whitelisted_host(url)) + not is_whitelisted_url(url)) def _read_hosts_file(self, filename, target): """Read hosts from the given filename.