def __init__(self, config_file=None, section='stackdio'): super(StackdioConfig, self).__init__() self.section = section self._cfg_file = os.path.abspath(config_file or CFG_FILE) self._config = ConfigParser() self.usable_file = os.path.isfile(self._cfg_file) if self.usable_file: self._config.read(self._cfg_file) self.usable_section = self._config.has_section(self.section) self.usable_config = self.usable_file and self.usable_section if not self.usable_section: self._config.add_section(section)