Archived
1
0

added function descriptions of read_sourceonfiguration and get_section

This commit is contained in:
RTB 2014-06-08 19:21:56 +02:00
parent 3278de2b3a
commit 09ab4249ba

View File

@ -50,12 +50,24 @@ class Configurator:
@staticmethod
def read_sourceconfiguration():
"""
This function reads sources.cfg in the main folder for configuration
variables for sources
:return a ConfigParser object of sources.cfg
"""
config = ConfigParser.ConfigParser()
config.read('sources.cfg') # [TODO]: should be softcoded eventually
return config
@staticmethod
def get_section(config, sourcename):
"""
This function reads a config section labeled in variable sourcename and
tests whether the reliability variable is set else set to empty string
:param config: a ConfigParser object
:param sourcename: the name of the section to be read
:return a dictionary of the section in the config labeled in sourcename
"""
section = dict()
if config.has_section(sourcename):
section = dict(config.items(sourcename))