def traclegos_factory(ini_files, configuration, variables): """ returns configuration needed to drive a TracLegos constructor * ini_files: site configuration .ini files * configuration: dictionary of overrides to TracLegos arguments * variables: used for template substitution """ # XXX could instead return a constructed TracLegos instance conf = site_configuration(*ini_files) site_wiki = conf['site-configuration'].pop('wiki', None) if site_wiki: configuration['wiki'] = [site_wiki] + configuration['wiki'] argspec = traclegos_argspec(conf['site-configuration'], configuration) argspec['vars'] = argspec['vars'] or {} argspec['vars'].update(conf['variables']) argspec['vars'].update(variables) # permissions: if conf['permissions']: conf['permissions'] = dict([ (key, getlist(value)) for key, value in conf['permissions'].items() ]) argspec['permissions'] = conf['permissions'] or None return argspec
def traclegos_factory(ini_files, configuration, variables): """ returns configuration needed to drive a TracLegos constructor * ini_files: site configuration .ini files * configuration: dictionary of overrides to TracLegos arguments * variables: used for template substitution """ # XXX could instead return a constructed TracLegos instance conf = site_configuration(*ini_files) site_wiki = conf['site-configuration'].pop('wiki', None) if site_wiki: configuration['wiki'] = [ site_wiki ] + configuration['wiki'] argspec = traclegos_argspec(conf['site-configuration'], configuration) argspec['vars'] = argspec['vars'] or {} argspec['vars'].update(conf['variables']) argspec['vars'].update(variables) # permissions: if conf['permissions']: conf['permissions'] = dict([(key, getlist(value)) for key, value in conf['permissions'].items()]) argspec['permissions'] = conf['permissions'] or None return argspec
def apply_permissions(envs, ini): munger = ConfigMunger(*ini) if munger.has_section('permissions'): add_permissions = dict([(i, getlist(j)) for i, j in munger['permissions'].items()]) else: add_permissions = None if munger.has_section('remove-permissions'): remove_permissions = dict([(i, getlist(j)) for i, j in munger['remove-permissions'].items()]) else: remove_permissions = None for env in envs: admin = TracLegosAdmin(env) if add_permissions: admin.add_permissions(add_permissions) if remove_permissions: admin.remove_permissions(remove_permissions)
def apply_permissions(envs, ini): munger = ConfigMunger(*ini) if munger.has_section('permissions'): add_permissions = dict([(i, getlist(j)) for i, j in munger['permissions'].items()]) else: add_permissions = None if munger.has_section('remove-permissions'): remove_permissions = dict([ (i, getlist(j)) for i, j in munger['remove-permissions'].items() ]) else: remove_permissions = None for env in envs: admin = TracLegosAdmin(env) if add_permissions: admin.add_permissions(add_permissions) if remove_permissions: admin.remove_permissions(remove_permissions)