(self)
Check for config file existance and create if it doesn't
Check for config file existance and create if it doesn't
Check for config file existance and create if it doesn t
def check_file(self):
        """
        Check for config file existance and create if it doesn't
        """
        if create_file(self.filepath):
            self.out.info("Created configuration file '%s'" % self.filepath)
            self.write_default_config(self.filepath)

        sample_filepath = self.filepath+'.sample'
        if create_file(sample_filepath):
            self.out.info("Created example configuration file '%s'" % sample_filepath)
            self.write_default_config(sample_filepath)

        # Add all configured sections
        self.cfgparser = ConfigParser.SafeConfigParser()
        for section, options in self.options.items():
            self.cfgparser.add_section(section)
        self.cfgparser.read(self.filepath)
def check_file ( self ) : if create_file ( self . filepath ) : self . out . info ( "Created configuration file '%s'" % self . filepath ) self . write_default_config ( self . filepath ) sample_filepath = self . filepath + '.sample' if create_file ( sample_filepath ) : self . out . info ( "Created example configuration file '%s'" % sample_filepath ) self . write_default_config ( sample_filepath ) # Add all configured sections self . cfgparser = ConfigParser . SafeConfigParser ( ) for section , options in self . options . items ( ) : self . cfgparser . add_section ( section ) self . cfgparser . read ( self . filepath )