Esempio n. 1
0
    def load_config_from_path(self):
        config = ConfigParse()
        if os.path.exists(self.config_path):
            config.read(self.config_path)
        else:
            config.read(self.default_config_path)

        return config
Esempio n. 2
0
 def __init__(self):
     '''
     获取绝对地址
     '''
     self.pwd = os.path.split(os.path.realpath(__file__))[0]
     self.config_path = os.path.join(
         os.path.split(self.pwd)[0], 'Config.ini')
     self.config_file = ConfigParse()
     self.config_file.read(self.config_path)
Esempio n. 3
0
 def __init__(self):
     self.pwd = os.path.split(os.path.realpath(__file__))[0]
     config_dir = os.path.split(self.pwd)[0]
     self.config_path = os.path.join(config_dir, 'Config.ini')
     if not os.path.isfile(self.config_path):
         self.config_path = os.path.join(config_dir, 'Config.ini.default')
         
     self.config_file = ConfigParse()
     self.config_file.read(self.config_path)
Esempio n. 4
0
    def __init__(self):
        super(ProxyConfig, self).__init__()

        pwd = os.path.split(os.path.realpath(__file__))[0]
        config_dir = os.path.split(pwd)[0]

        config_path = os.path.join(config_dir, 'Config.ini.default')
        config = ConfigParse()
        config.read(config_path)
        self.initConfig(config)
        self.cf = config

        config_path = os.path.join(config_dir, 'Config.ini')
        if os.path.isfile(config_path):
            config.read(config_path)
            self.initConfig(config)
            self.cf = config
Esempio n. 5
0
 def __init__(self):
     self.pwd = os.path.split(os.path.realpath(__file__))[0]
     self.config_path = os.path.join(
         os.path.split(self.pwd)[0], 'Config.ini')
     self.config_file = ConfigParse(defaults={"password": ""})
     self.config_file.read(self.config_path)