# Prepare our default template engine if template_engine == 'pylonsmyghty': self.add_template_engine('pylonsmyghty', None, myghty_template_options) elif template_engine == 'mako': self.add_template_engine('mako', '') elif template_engine in ['genshi', 'kid']: self.add_template_engine(template_engine, conf['pylons.package'] + '.templates') elif template_engine == 'cheetah': self.add_template_engine(template_engine, '%s.templates' % conf['pylons.package']) log.debug("Loaded %s template engine as the default template " "renderer", template_engine) conf['pylons.cache_dir'] = conf.pop('cache_dir', conf['app_conf'].get('cache_dir')) # Save our errorware values conf['pylons.errorware'] = errorware pylons_config = PylonsConfig() # Push an empty config so all accesses to config at import time have something # to look at and modify. This config will be merged with the app's when it's # built in the paste.app_factory entry point. pylons_config.update(copy.deepcopy(PylonsConfig.defaults)) config.push_process_config(pylons_config)
'error_subject_prefix', 'WebApp Error: ') errorware['from_address'] = conf.get( 'from_address', conf.get('error_email_from', '*****@*****.**')) errorware['error_message'] = conf.get( 'error_message', 'An internal server error occurred') # Copy in some defaults if 'cache_dir' in conf: conf.setdefault('beaker.session.data_dir', os.path.join(conf['cache_dir'], 'sessions')) conf.setdefault('beaker.cache.data_dir', os.path.join(conf['cache_dir'], 'cache')) conf['pylons.cache_dir'] = conf.pop('cache_dir', conf['app_conf'].get('cache_dir')) # Save our errorware values conf['pylons.errorware'] = errorware # Load conf dict into self self.update(conf) pylons_config = PylonsConfig() # Push an empty config so all accesses to config at import time have something # to look at and modify. This config will be merged with the app's when it's # built in the paste.app_factory entry point. pylons_config.update(copy.deepcopy(PylonsConfig.defaults)) config.push_process_config(pylons_config)
conf['bootstrappy.paths'] = paths conf['bootstrappy.package'] = package conf['debug'] = asbool(conf.get('debug')) # Load the MIMETypes with its default types MIMETypes.init() for key, val in copy.deepcopy(self.defaults).iteritems(): conf.setdefault(key, val) if 'cache_dir' in conf: conf.setdefault('beaker.session.data_dir', os.path.join(conf['cache_dir'], 'sessions')) conf.setdefault('beaker.cache.data_dir', os.path.join(conf['cache_dir'], 'cache')) conf['bootstrappy.cache_dir'] = conf.pop( 'cache_dir', conf['app_conf'].get('cache_dir')) # Save our errorware values # Pylons did this nicely... still thinking about it. # conf['bootstrappy.errorware'] = errorware self.update(conf) # Push the config object down to the DC bootstrappy_config = BootstrapPyConfig() bootstrappy_config.update(copy.deepcopy(BootstrapPyConfig.defaults)) config.push_process_config(bootstrappy_config)
if paths: conf['pyblox.paths'] = paths conf['pyblox.package'] = package conf['debug'] = asbool(conf.get('debug')) # Load the MIMETypes with its default types MIMETypes.init() for key, val in copy.deepcopy(self.defaults).iteritems(): conf.setdefault(key, val) if 'cache_dir' in conf: conf.setdefault('beaker.session.data_dir', os.path.join(conf['cache_dir'], 'sessions')) conf.setdefault('beaker.cache.data_dir', os.path.join(conf['cache_dir'], 'cache')) conf['pyblox.cache_dir'] = conf.pop('cache_dir', conf['app_conf'].get('cache_dir')) # Save our errorware values # Pylons did this nicely... still thinking about it. # conf['pyblox.errorware'] = errorware self.update(conf) # Push the config object down to the DC pyblox_config = PyBloxConfig() pyblox_config.update(copy.deepcopy(PyBloxConfig.defaults)) config.push_process_config(pyblox_config)
v = super(InGoConfig, self).get(k, {}) except AttributeError: raise AttributeError('%s is not set in path (%s)' % (k, name)) continue try: v = v.get(k) except AttributeError, e: if i == cnt-1: if default: return default raise AttributeError('%s is not set in path (%s)' % (parts[i-1], name)) return v return super(InGoConfig, self).get(name, default) ingo_config = InGoConfig() ingo_config.update(copy.deepcopy(InGoConfig.defaults)) config.push_process_config(ingo_config) class ConfigurationException(Exception): pass class ConfigurationImplementationError(ConfigurationException): pass class ConfigurationNotFound(ConfigurationException): pass class Configuration(object): """docstring for Configuration""" def __init__(self, implementation="yml"): super(Configuration, self).__init__() self._impl_name = implementation self._impl = None self._config = dict() self._config_parts = dict()