mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 11:12:15 +03:00
config manager style fixed
This commit is contained in:
parent
14c6a600d5
commit
bc582b7616
1 changed files with 7 additions and 7 deletions
|
@ -16,26 +16,26 @@ class ConfigManager(object):
|
||||||
is configuration files folder path
|
is configuration files folder path
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, configurationFilePath=None, configurationFolderPath=None):
|
def __init__(self, configuration_file_path=None, configuration_folder_path=None):
|
||||||
self.configurationFilePath = configurationFilePath
|
self.configurationFilePath = configuration_file_path
|
||||||
self.configurationFolderPath = configurationFolderPath
|
self.configurationFolderPath = configuration_folder_path
|
||||||
|
|
||||||
def read(self):
|
def read(self):
|
||||||
configFiles = []
|
config_files = []
|
||||||
|
|
||||||
# Check if given ahenk configuration file exists
|
# Check if given ahenk configuration file exists
|
||||||
# If file exists add it to configFiles array.
|
# If file exists add it to configFiles array.
|
||||||
# TODO must write config file validater !!
|
# TODO must write config file validater !!
|
||||||
if self.configurationFilePath:
|
if self.configurationFilePath:
|
||||||
if os.path.exists(self.configurationFilePath):
|
if os.path.exists(self.configurationFilePath):
|
||||||
configFiles.append(self.configurationFilePath)
|
config_files.append(self.configurationFilePath)
|
||||||
|
|
||||||
if self.configurationFolderPath and os.path.exists(self.configurationFolderPath):
|
if self.configurationFolderPath and os.path.exists(self.configurationFolderPath):
|
||||||
files = [f for f in listdir(self.configurationFolderPath) if isfile(join(self.configurationFolderPath, f))]
|
files = [f for f in listdir(self.configurationFolderPath) if isfile(join(self.configurationFolderPath, f))]
|
||||||
for f in files:
|
for f in files:
|
||||||
configFiles.append(join(self.configurationFolderPath, f))
|
config_files.append(join(self.configurationFolderPath, f))
|
||||||
|
|
||||||
parser = SafeConfigParser()
|
parser = SafeConfigParser()
|
||||||
configValues = parser.read(configFiles)
|
configValues = parser.read(config_files)
|
||||||
|
|
||||||
return parser
|
return parser
|
||||||
|
|
Loading…
Reference in a new issue