Prevent certain erroring configuration lines from being processed by a later line_ok().

This commit is contained in:
Thomas Hurst 2008-09-02 16:03:08 +01:00
parent e8be0f326c
commit 8fd22efed2
1 changed files with 11 additions and 5 deletions

View File

@ -144,12 +144,10 @@ class ConfigFile:
if self._line[self._pos:] != '': if self._line[self._pos:] != '':
raise ConfigSyntaxError(_("Unexpected token"), self) raise ConfigSyntaxError(_("Unexpected token"), self)
self._line_ok()
except ConfigSyntaxError, e: except ConfigSyntaxError, e:
if self.errors_are_fatal: self._line_error(e)
raise e
else: else:
self.errors.append(e) self._line_ok()
if self.errors: if self.errors:
raise ParsedWithErrors(self.filename, self.errors) raise ParsedWithErrors(self.filename, self.errors)
@ -176,3 +174,11 @@ class ConfigFile:
finally: finally:
self._currvalue = None self._currvalue = None
def _line_error(self, e):
self._currvalue = None
if self.errors_are_fatal:
raise e
else:
self.errors.append(e)