import ConfigParser class AliasConfig(object): def __init__(self): self.name = None self.root = None self.host = None self.secret = None self.port = None self.background = None self.logfile = None self.pidfile = None def read(self, filename): config = ConfigParser.SafeConfigParser() config.read(filename) self.name = config.get("component", "name") self.root = config.get("component", "root") self.host = config.get("component", "host") self.secret = config.get("component", "secret") self.port = config.getint("component", "port") self.background = config.getboolean("component", "background") if config.has_option("component", "logfile"): self.logfile = config.get("component", "logfile") if config.has_option("component", "pidfile"): self.pidfile = config.get("component", "pidfile") config = AliasConfig()