Fix warningregex setting in GUI.

This commit is contained in:
Bastian Kleineidam 2014-03-20 20:46:58 +01:00
parent 9cd67dfcb2
commit 098dede12c
2 changed files with 7 additions and 7 deletions

View file

@ -25,6 +25,8 @@ Fixes:
- checking: Fix assertion in external link checking.
- checking: Fix SSL errors on Windows.
Closes: GH bug #471
- gui: Fix warning regex settings.
Closes: GH bug #485
9.0 "The Wolf of Wall Street" (released 3.3.2014)

View file

@ -262,13 +262,9 @@ class LinkCheckerMain (QtGui.QMainWindow, Ui_MainWindow):
if data["warninglines"]:
lines = data["warninglines"].splitlines()
pattern = warninglines2regex(lines)
try:
ro = re.compile(pattern)
self.backup_config("warningregex", ro)
except re.error as err:
msg = _("Invalid regular expression %r: %s" % (pattern, err))
self.set_statusmsg(msg)
args = dict(warningregex=pattern)
self.backup_config("enabledplugins", ["RegexCheck"])
self.config["RegexCheck"] = args
# set ignore patterns
ignorepats = data["ignorelines"].strip()
if ignorepats:
@ -281,6 +277,8 @@ class LinkCheckerMain (QtGui.QMainWindow, Ui_MainWindow):
except re.error as err:
msg = _("Invalid regular expression %r: %s" % (pat, err))
self.set_statusmsg(msg)
# make sure the configuration is sane
self.config.sanitize()
def backup_config (self, key, value=None):
"""Backup config key if not already done and set given value."""