def getConfig(args): mint_solr_url = "{mint_protocol}://{mint_host}:{mint_port}/solr/fascinator".format(**(args.__dict__)) mint_url = "{mint_protocol}://{mint_host}:{mint_port}/{redbox_context}".format(**(args.__dict__)) redbox_url = "{redbox_protocol}://{redbox_host}:{redbox_port}/{redbox_context}".format(**(args.__dict__)) return config_helper({ "mint_url":mint_url, "mint_solr_url": mint_solr_url, "redbox_url":redbox_url, "anzsrc_query": '{mint_solr_url}/select?wt=json&q=dc_identifier%%3D"{query}"'.format(mint_solr_url=mint_solr_url, query="%s"), "dc_i_query": '{mint_solr_url}/select?wt=json&q=dc_identifier%%3D"{query}"'.format(mint_solr_url=mint_solr_url, query="%s"), "user_query": '{mint_solr_url}/select?wt=json&q=known_ids%%3D"{query}"'.format(mint_solr_url=mint_solr_url, query="%s"), "field_query": '{mint_solr_url}/select?wt=json&q={field}%3A{value}', "license_url": "{redbox_url}/default/workflows/forms/data/licences.json".format(redbox_url=redbox_url) })
else: print "__________________" elif isinstance(n, _Element): print i, n else: print "---------------->",n.__class__ if __name__ == "__main__": default_redbox_path = os.path.abspath(os.path.join(os.path.split(sys.argv[0])[0], "..", "..", "config", "home", "alerts", "config", "rifXmlMap.json")) argParse = ArgumentParser(description="Process the JCU RIF-CS imports") argParse.add_argument('-p','--map-path', dest='path', nargs=1, action='store', default=default_redbox_path, help='The map file to use, default: '+default_redbox_path) argParse.add_argument('file', nargs='+', help='The RIF-CS Files to process (globs accepted)') args = argParse.parse_args() map_file = open(args.path) map = config_helper(json.load(map_file)) map_file.close() for fl in args.file: for _file in glob.glob(fl): print "Processing: ", _file tree = ET.parse(_file) remove_used_nodes(map.mappings, tree) tree.write(sys.stdout, encoding='utf-8') print "" print "============================================================================="