add onlinedc config-option

* inverse of --noonlinedc
This commit is contained in:
Thor77 2016-06-25 20:34:17 +02:00
parent 573838c35e
commit 892680fe4d
3 changed files with 9 additions and 4 deletions

View File

@ -53,7 +53,7 @@ def main(config=None, idmap=None, log=None,
config = abspath(config)
if not exists(config):
logger.fatal('config not found (%s)', config)
idmap, log, output, debug = parse_config(config)
idmap, log, output, debug, noonlinedc = parse_config(config)
if debug:
logger.setLevel(logging.DEBUG)

View File

@ -28,10 +28,13 @@ def parse_config(config_path):
config_items = dict(config.items('General'))
if 'debug' in config_items:
config_items['debug'] = config.getboolean('General', 'debug')
if 'onlinedc' in config_items:
config_items['onlinedc'] = config.getboolean('General', 'onlinedc')
logger.debug('raw config: %s', config_items)
return (
config_items.get('idmap'),
config_items.get('log'),
config_items.get('output'),
config_items.get('debug', False)
config_items.get('debug', False),
config_items.get('onlinedc', True)
)

View File

@ -35,10 +35,12 @@ def test_config(config):
'idmap': 'tsstats/tests/res/id_map.json',
'log': 'tsstats/tests/res/test.log',
'output': 'output.html',
'debug': 'true'
'debug': 'true',
'onlinedc': 'false'
})
idmap, log, output, debug = parse_config(configpath)
idmap, log, output, debug, onlinedc = parse_config(configpath)
assert idmap == 'tsstats/tests/res/id_map.json'
assert log == 'tsstats/tests/res/test.log'
assert output == 'output.html'
assert debug is True
assert onlinedc is False