def parseSetting(self, key, value): """ Parse a single setting for this object. Settings are written in text files in a key=value fashion. For each such setting that belongs to this object this method will be called. After all settings have been given, the method checkSettings will be called. If a setting does not parse correctly, this method raises an Exception with a descriptive message. Subclassers should first parse their own settings and then call this implementation to have the generic settings parsed and to have any unknown settings raise an Exception. @param key The name of the parameter, i.e. the key from the key=value pair. @param value The value of the parameter, i.e. the value from the key=value pair. """ if key == 'script': if self.script: parseError( "Script has already been set: {0}".format( self.script ) ) if not os.path.exists( value ) or not os.path.isfile( value ): parseError( "Script file '{0}' seems not be an existing file".format( value ) ) self.script = value elif key == 'showErrors': if value == 'yes': self.showErrors = True else: processor.parseSetting(self, key, value)
def parseSetting(self, key, value): """ Parse a single setting for this object. Settings are written in text files in a key=value fashion. For each such setting that belongs to this object this method will be called. After all settings have been given, the method checkSettings will be called. If a setting does not parse correctly, this method raises an Exception with a descriptive message. Subclassers should first parse their own settings and then call this implementation to have the generic settings parsed and to have any unknown settings raise an Exception. @param key The name of the parameter, i.e. the key from the key=value pair. @param value The value of the parameter, i.e. the value from the key=value pair. """ # TODO: Parse your settings. Example: # # if key == 'content': # if content = '': # parseError( "We're not going to write nothing, are we? That'd be useless." ) # if not self.content: # self.content = [value] # else: # self.content.append( value ) # else: # processor.parseSetting(self, key, value) # # Do not forget that last case! # # The following implementation assumes you have no parameters specific to your processor: processor.parseSetting(self, key, value)
def parseSetting(self, key, value): """ Parse a single setting for this object. Settings are written in text files in a key=value fashion. For each such setting that belongs to this object this method will be called. After all settings have been given, the method checkSettings will be called. If a setting does not parse correctly, this method raises an Exception with a descriptive message. Subclassers should first parse their own settings and then call this implementation to have the generic settings parsed and to have any unknown settings raise an Exception. @param key The name of the parameter, i.e. the key from the key=value pair. @param value The value of the parameter, i.e. the value from the key=value pair. """ processor.parseSetting(self, key, value)