
* Custom date directories * Add config module to parse ini files * Add method/tests to get a customizable folder path * Cache path definition * Initial working version of custom paths * Add Directory values in sample config * Refactoring location parsing logic and adding tests * Remove unused functions * Add documentation to parse_mask_for_location * Remove commented out code * Add tests for migrating old location db to new
20 lines
460 B
Python
20 lines
460 B
Python
"""Load config file as a singleton."""
|
|
from configparser import RawConfigParser
|
|
from os import path
|
|
|
|
from elodie import constants
|
|
|
|
config_file = '%s/config.ini' % constants.application_directory
|
|
|
|
|
|
def load_config():
|
|
if hasattr(load_config, "config"):
|
|
return load_config.config
|
|
|
|
if not path.exists(config_file):
|
|
return {}
|
|
|
|
load_config.config = RawConfigParser()
|
|
load_config.config.read(config_file)
|
|
return load_config.config
|