X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfa%2Futil%2Fconfig.py;fp=sfa%2Futil%2Fconfig.py;h=04b2b2d6c6ebc4c303f16c2dca898775220920ae;hp=67e81c4286c2b79e4e23e78a7f25cc57ce45fbd6;hb=04acd3228e5911d36d0cd58dc35b9319fc558e17;hpb=e5537b113b6fe5874fdcd5b12414568500aa106c diff --git a/sfa/util/config.py b/sfa/util/config.py index 67e81c42..04b2b2d6 100644 --- a/sfa/util/config.py +++ b/sfa/util/config.py @@ -8,7 +8,7 @@ import time #import tempfile from io import StringIO from sfa.util.xml import XML -from sfa.util.py23 import ConfigParser +import configparser default_config = \ """ @@ -28,7 +28,7 @@ class Config: def __init__(self, config_file='/etc/sfa/sfa_config'): self._files = [] self.config_path = os.path.dirname(config_file) - self.config = ConfigParser.ConfigParser() + self.config = configparser.ConfigParser() self.filename = config_file if not os.path.isfile(self.filename): self.create(self.filename) @@ -56,7 +56,7 @@ DO NOT EDIT. This file was automatically generated at if filename: try: self.config.read(filename) - except ConfigParser.MissingSectionHeaderError: + except configparser.MissingSectionHeaderError: if filename.endswith('.xml'): self.load_xml(filename) else: @@ -107,7 +107,7 @@ DO NOT EDIT. This file was automatically generated at section_name = section.lower() var_name = varname.replace(section_name, "")[1:] if strict and not self.config.has_option(section_name, var_name): - raise ConfigParser.NoOptionError(var_name, section_name) + raise configparser.NoOptionError(var_name, section_name) return (section_name, var_name) def set_attributes(self): @@ -190,10 +190,10 @@ DO NOT EDIT. This file was automatically generated at @staticmethod def is_ini(config_file): try: - c = ConfigParser.ConfigParser() + c = configparser.ConfigParser() c.read(config_file) return True - except ConfigParser.MissingSectionHeaderError: + except configparser.MissingSectionHeaderError: return False def dump(self, sections=None):