Example #1
0
File: conf.py Project: lcrees/stage
def localconf(this, attribute='Meta', *args, **kw):
    '''
    Load local configuration from `attribute` on `this` class and its base
    classes (plus any custom configuration).
    '''
    return (lazyknife(this).mro().attrs(attribute).traverse().attrs('maps')
    .merge().params(*args, **kw).invoke('update').reverse().mapping()
    .wrap(frozenstuf).get())
Example #2
0
File: conf.py Project: lcrees/stage
 def _load(self, destination, conf):
     # load configuration
     if isstring(conf):
         # load import
         conf = lazyimport(conf)
     if isinstance(conf, _BaseFactory):
         # load configuration from factory
         destination.update(i for i in conf)
     elif isclass(conf):
         # load configuration from class
         newconf = {}
         xpartmap(
             lambda x, y: x({y.pop('classname', 'options'): y}),
             iter(lazyknife(conf).traverse().attrs('maps').merge()),
             newconf.update,
         )
         destination.update(newconf)