config manager style fixed

This commit is contained in:
Volkan Şahin 2016-08-18 21:03:36 +03:00
parent 14c6a600d5
commit bc582b7616

View file

@ -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