BreakWa11
8 years ago
8 changed files with 68 additions and 51 deletions
@ -1,27 +1,15 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding: UTF-8 -*- |
|||
import importloader |
|||
|
|||
config = None |
|||
g_config = None |
|||
|
|||
def load_config(): |
|||
global config |
|||
try: |
|||
import userapiconfig |
|||
reload(userapiconfig) |
|||
config = userapiconfig |
|||
return |
|||
except: |
|||
pass |
|||
try: |
|||
import apiconfig |
|||
reload(apiconfig) |
|||
config = apiconfig |
|||
except: |
|||
pass |
|||
global g_config |
|||
g_config = importloader.loads(['userapiconfig', 'apiconfig']) |
|||
|
|||
def get_config(): |
|||
global config |
|||
return config |
|||
return g_config |
|||
|
|||
load_config() |
|||
|
|||
|
@ -0,0 +1,22 @@ |
|||
#!/usr/bin/python |
|||
# -*- coding: UTF-8 -*- |
|||
|
|||
def load(name): |
|||
try: |
|||
obj = __import__(name) |
|||
return obj |
|||
except: |
|||
pass |
|||
|
|||
try: |
|||
import importlib |
|||
obj = importlib.__import__(name) |
|||
return obj |
|||
except: |
|||
pass |
|||
|
|||
def loads(namelist): |
|||
for name in namelist: |
|||
obj = load(name) |
|||
if obj is not None: |
|||
return obj |
Loading…
Reference in new issue