def __load_config(self): """ Populates self._config with a new ConfigParser instance """ cfg = self.cfg_file if utils.is_url(cfg): cfg = self._get_urlfp(cfg) else: cfg = self._get_fp(cfg) try: cp = ConfigParser.ConfigParser() cp.readfp(cfg) return cp except ConfigParser.MissingSectionHeaderError,e: raise exception.ConfigHasNoSections(cfg.name)
def __load_config(self): """ Populates self._config with a new ConfigParser instance """ cfg = self.cfg_file if utils.is_url(cfg): cfg = self._get_urlfp(cfg) else: cfg = self._get_fp(cfg) try: cp = ConfigParser.ConfigParser() cp.readfp(cfg) return cp except ConfigParser.MissingSectionHeaderError: raise exception.ConfigHasNoSections(cfg.name) except ConfigParser.ParsingError, e: raise exception.ConfigError(e)
def _get_cfg_fp(self, cfg_file=None): cfg = cfg_file or self.cfg_file if utils.is_url(cfg): return self._get_urlfp(cfg) else: return self._get_fp(cfg)