From 414ab88a0ee3ab5dfe6bff1096e6029d965a381e Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 9 Sep 2014 18:32:18 +0200 Subject: [PATCH] Fix lint --- qutebrowser/app.py | 3 ++- qutebrowser/config/keyconfparser.py | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index ce57d763d..2f7fedb82 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -103,6 +103,7 @@ class Application(QApplication): self.modeman = None self.cmd_history = None self.config = None + self.keyconfig = None sys.excepthook = self._exception_hook @@ -195,7 +196,7 @@ class Application(QApplication): except keyconfparser.KeyConfigError as e: log.init.exception(e) errstr = "Error while reading key config:\n" - if hasattr(e, 'lineno'): + if e.lineno is not None: errstr += "In line {}: ".format(e.lineno) errstr += str(e) msgbox = QMessageBox(QMessageBox.Critical, diff --git a/qutebrowser/config/keyconfparser.py b/qutebrowser/config/keyconfparser.py index a2e9ec4ce..9e8cd2dd9 100644 --- a/qutebrowser/config/keyconfparser.py +++ b/qutebrowser/config/keyconfparser.py @@ -29,7 +29,15 @@ from qutebrowser.utils import log class KeyConfigError(Exception): - """Raised on errors with the key config.""" + """Raised on errors with the key config. + + Attributes: + lineno: The config line in which the exception occured. + """ + + def __init__(self): + super().__init__() + self.lineno = None class KeyConfigParser: