Zionetrix::Git
Repositories
Help
Report an Issue
MyCoServer
Code
Commits
Branches
Tags
Search
Tree:
7004713
Branches
Tags
master
MyCoServer
mycoserver
configuration.py
Initial commit
Benjamin Renard
commited
7004713
at 2014-01-12 00:33:07
configuration.py
Blame
History
Raw
# -*- coding: utf-8 -*- """Paste INI configuration""" import os from biryani1 import strings from biryani1.baseconv import (check, default, guess_bool, pipe, struct) def load_configuration(global_conf, app_conf): """Build the application configuration dict.""" app_dir = os.path.dirname(os.path.abspath(__file__)) conf = {} conf.update(strings.deep_decode(global_conf)) conf.update(strings.deep_decode(app_conf)) conf.update(check(struct( { 'app_conf': default(app_conf), 'app_dir': default(app_dir), 'cache_dir': default(os.path.join(os.path.dirname(app_dir), 'cache')), 'debug': pipe(guess_bool, default(False)), 'global_conf': default(global_conf), }, default='drop', drop_none_values=False, ))(conf)) return conf