# -*- coding: utf-8 -*-

try:
    from configparser import RawConfigParser
except ImportError:
    from ConfigParser import RawConfigParser

import logging

logger = logging.getLogger('tsstats')


DEFAULT_CONFIG = {
    'General': {
        'debug': False,
        'log': '',
        'output': 'output.html',
        'idmap': '',
        'onlinedc': True,
        'template': 'template.html',
        'datetimeformat': '%x %X %Z'
    }
}


def load(path=None):
    '''
    parse config at `config_path`

    :param config_path: path to config-file
    :type config_path: str

    :return: values of config
    :rtype: tuple
    '''
    logger.debug('reading config')
    config = RawConfigParser()
    # use this way to set defaults, because ConfigParser.read_dict
    # is not available < 3.2
    for section, items in DEFAULT_CONFIG.items():
        if section not in config.sections():
            config.add_section(section)
        for key, value in items.items():
            config.set(section, key, str(value))
    if path:
        config.read(path)
    return config

# -*- coding: utf-8 -*-

try:
    from configparser import RawConfigParser
except ImportError:
    from ConfigParser import RawConfigParser

import logging

logger = logging.getLogger('tsstats')


DEFAULT_CONFIG = {
    'General': {
        'debug': False,
        'log': '',
        'output': 'tsstats.html',
        'idmap': '',
        'onlinedc': True,
        'template': 'template.html',
        'datetimeformat': '%x %X %Z'
    }
}


def load(path=None):
    '''
    parse config at `config_path`

    :param config_path: path to config-file
    :type config_path: str

    :return: values of config
    :rtype: tuple
    '''
    logger.debug('reading config')
    config = RawConfigParser()
    # use this way to set defaults, because ConfigParser.read_dict
    # is not available < 3.2
    for section, items in DEFAULT_CONFIG.items():
        if section not in config.sections():
            config.add_section(section)
        for key, value in items.items():
            config.set(section, key, str(value))
    if path:
        config.read(path)
    return config

Set default for General.output to tsstats.html
Set default for General.output to tsstats.html
