コード例 #1
0
 def init_config(cls, config_path=constants.CONFIG_PATH):
     conf = _ConfigParser()
     conf.read(config_path)
     _d = conf.to_dict()
     for k, v in _d.items():
         if isinstance(v, dict):
             for i, j in v.items():
                 if j.lower() in ('false', 'true'):
                     j = True if j.lower() == 'true' else False
                 setattr(cls, i.upper(), j)
コード例 #2
0
 def init_config(cls, config_path="terminal_server.ini"):
     if config_path == "terminal_server.ini":
         config_path = os.path.join(BASE_DIR, "config", config_path)
     conf = _ConfigParser()
     conf.read(config_path)
     _d = conf.to_dict()
     for k, v in _d.items():
         if isinstance(v, dict):
             for i, j in v.items():
                 if j.lower() in ('false', 'true'):
                     j = True if j.lower() == 'true' else False
                 setattr(cls, i.upper(), j)