def done(self, line): location = (self._filename, format_line(self._start_line, line)) section = Section( self.name, location=location, configuration=self.configuration) option = None for line_number, text in self._lines: new_option = OptionParser.new_option( section, text, self._filename, line_number) if new_option is not None: if option is not None: option.done(line_number - 1) option = new_option else: if option is not None: option.add(line, text) else: raise ConfigurationError( location, u'garbage text before option at line %s' % line_number) if option is not None: option.done(line_number) self.configuration.sections[self.name] = section
def done(self, line): if line == self._start_line: line = None option_value = '' for line, text in self._lines: option_value += text self.section.options[self.name] = Option( self.name, option_value, location=(self._filename, format_line(self._start_line, line)), section=self.section, operator=self._operator)