From 8fd22efed27d3b2f6a994fb01a839ca0ba7794ae Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Tue, 2 Sep 2008 16:03:08 +0100 Subject: [PATCH] Prevent certain erroring configuration lines from being processed by a later line_ok(). --- terminatorlib/configfile.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/terminatorlib/configfile.py b/terminatorlib/configfile.py index ee6e5e56..f7c0374e 100644 --- a/terminatorlib/configfile.py +++ b/terminatorlib/configfile.py @@ -144,12 +144,10 @@ class ConfigFile: if self._line[self._pos:] != '': raise ConfigSyntaxError(_("Unexpected token"), self) - self._line_ok() except ConfigSyntaxError, e: - if self.errors_are_fatal: - raise e - else: - self.errors.append(e) + self._line_error(e) + else: + self._line_ok() if self.errors: raise ParsedWithErrors(self.filename, self.errors) @@ -176,3 +174,11 @@ class ConfigFile: finally: self._currvalue = None + def _line_error(self, e): + self._currvalue = None + if self.errors_are_fatal: + raise e + else: + self.errors.append(e) + +