Procházet zdrojové kódy

[fix] fix password

jhao před 7 roky
rodič
revize
223f57d1eb
2 změnil soubory, kde provedl 4 přidání a 9 odebrání
  1. 2 7
      Util/GetConfig.py
  2. 2 2
      Util/utilClass.py

+ 2 - 7
Util/GetConfig.py

@@ -26,7 +26,7 @@ class GetConfig(object):
     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 = ConfigParse(defaults={"password": None})
         self.config_file.read(self.config_path)
 
     @LazyProperty
@@ -47,7 +47,7 @@ class GetConfig(object):
 
     @LazyProperty
     def db_password(self):
-        return self.config_file.get('DB', 'password', fallback=None)
+        return self.config_file.get('DB', 'password')
 
     @LazyProperty
     def proxy_getter_functions(self):
@@ -61,10 +61,6 @@ class GetConfig(object):
     def host_port(self):
         return int(self.config_file.get('API', 'port'))
 
-    @LazyProperty
-    def processes(self):
-        return int(self.config_file.get('API', 'processes'))
-
 
 config = GetConfig()
 
@@ -77,5 +73,4 @@ if __name__ == '__main__':
     print(gg.proxy_getter_functions)
     print(gg.host_ip)
     print(gg.host_port)
-    print(gg.processes)
     print(gg.db_password)

+ 2 - 2
Util/utilClass.py

@@ -44,8 +44,8 @@ class ConfigParse(ConfigParser):
     rewrite ConfigParser, for support upper option
     """
 
-    def __init__(self):
-        ConfigParser.__init__(self)
+    def __init__(self, *args, **kwargs):
+        ConfigParser.__init__(self, *args, **kwargs)
 
     def optionxform(self, optionstr):
         return optionstr