def parse_config(filename): conf = Dotconf.from_filename(filename, schema=RootRestdnsCliConfig()) return conf.parse()
plugin 'ugly' { common_value = 456 ugly_value = no } ''' # # This is where the magic happen: # if __name__ == '__main__': my_plugins = (BeautifulPlugin, UglyPlugin) enabled_plugins = [] # Parse the global configuration: config = Dotconf(TEST_CONFIG, schema=MainConfigurationSchema()) try: pconfig = config.parse() except (ValidationError, ParsingError) as err: if err.position is not None: print str(err.position) print err sys.exit(1) else: print 'Main configuration:' pprint(pconfig.to_dict()) # Enable each used plugins: for plugin_conf in pconfig.subsections('plugin'): # Search the plugin: for plugin in my_plugins:
def parse_config(filename): conf = Dotconf.from_filename(filename, schema=RootKolektoConfig()) return conf.parse()