Merge pull request #480 from cjmayo/blacklist

Fix blacklist updating
This commit is contained in:
Chris Mayo 2020-08-20 19:48:59 +01:00 committed by GitHub
commit e9db151145
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,6 +21,7 @@ import os
from linkcheck.configuration import get_user_data
from . import _Logger
from .. import log, LOG_CHECK
class BlacklistLogger(_Logger):
@ -83,6 +84,14 @@ class BlacklistLogger(_Logger):
if line.startswith('#') or not line:
continue
value, key = line.split(None, 1)
key = key.strip('"')
if not key.startswith('('):
log.critical(
LOG_CHECK,
_("invalid line starting with '%(linestart)s' in %(blacklist)s")
% {"linestart": line[:12], "blacklist": self.filename}
)
raise SystemExit(2)
self.blacklist[key] = int(value)
def write_blacklist(self):