def remove_section(self, section): if self.has_section: self.cfg.remove_section(section) return True else: raise exception.SectionDoesNotExist( "In global.cfg, the section %s is nonexist" % section)
def has_option(self, section, option): if self.has_section(section): if self.cfg.has_option(section, option): return True else: return False else: raise exception.SectionDoesNotExist( "In global.cfg, the section %s is nonexist" % section)
def get_value(self, section, option): if self.has_section: if self.has_option: return self.cfg.get(section, option) else: raise exception.OptionDoesNotExist( "In global.cfg, the option %s is nonexist" % option) else: raise exception.SectionDoesNotExist( "In global.cfg, the section %s is nonexist" % section)
def set_value(self, section, option, value): if self.has_section: if self.has_option: self.cfg.set(section, option, value) return True else: raise exception.OptionDoesNotExist( "In global.cfg, the option %s is nonexist" % option) raise exception.SectionDoesNotExist( "In global.cfg, the section %s is nonexist" % section)
def get_items(self, section): if self.has_section: return self.cfg.items(section) else: raise exception.SectionDoesNotExist( "In global.cfg, the section %s is nonexist" % section)