Stylistic changes to is_whitelisted_domain

This commit is contained in:
Daniel 2015-09-16 17:04:19 +02:00
parent ccdb59cce1
commit 523e071a97

View File

@ -25,7 +25,6 @@ import functools
import posixpath
import zipfile
import fnmatch
import re
from qutebrowser.config import config
from qutebrowser.utils import objreg, standarddir, log, message
@ -67,14 +66,12 @@ def is_whitelisted_domain(host):
Args:
host: The host as given by the adblocker as string.
"""
whitelist = objreg.get('config').get('content', 'host-blocking-whitelist')
whitelist = config.get('content', 'host-blocking-whitelist')
if whitelist is None:
return False
for domain in whitelist:
fnmatch_translated = fnmatch.translate(domain)
domain_regex = re.compile(fnmatch_translated, re.IGNORECASE)
if domain_regex.match(host):
for pattern in whitelist:
if fnmatch.fnmatch(host, pattern.lower()):
return True
return False