obi import: fixed bug when importing a taxdump
This commit is contained in:
@ -144,25 +144,24 @@ def run(config):
|
|||||||
|
|
||||||
o_dms = output[0]
|
o_dms = output[0]
|
||||||
|
|
||||||
# If importing a view between two DMS, use C API
|
# Read taxdump
|
||||||
if isinstance(input[1], View):
|
if config['obi']['taxdump']: # The input is a taxdump to import in a DMS
|
||||||
if obi_import_view(input[0].name_with_full_path, o_dms.name_with_full_path, input[1].name, tobytes((config['obi']['outputURI'].split('/'))[-1])) < 0 :
|
# Check if taxonomy name isn't already taken
|
||||||
raise Exception("Error importing a view in a DMS")
|
taxo_name = output[1].split(b'/')[1]
|
||||||
|
if Taxonomy.exists(o_dms, taxo_name):
|
||||||
|
raise Exception("Taxonomy name already exists in this DMS")
|
||||||
|
taxo = Taxonomy.open_taxdump(o_dms, config['obi']['inputURI'])
|
||||||
|
taxo.write(taxo_name)
|
||||||
|
taxo.close()
|
||||||
o_dms.record_command_line(" ".join(sys.argv[1:]))
|
o_dms.record_command_line(" ".join(sys.argv[1:]))
|
||||||
o_dms.close()
|
o_dms.close()
|
||||||
logger("info", "Done.")
|
logger("info", "Done.")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# If importing a view between two DMS, use C API
|
||||||
# Read taxdump
|
if isinstance(input[1], View):
|
||||||
if config['obi']['taxdump']: # The input is a taxdump to import in a DMS
|
if obi_import_view(input[0].name_with_full_path, o_dms.name_with_full_path, input[1].name, tobytes((config['obi']['outputURI'].split('/'))[-1])) < 0 :
|
||||||
# Check if taxonomy name isn't already taken
|
raise Exception("Error importing a view in a DMS")
|
||||||
taxo_name = output[1]
|
|
||||||
if Taxonomy.exists(o_dms, taxo_name.split(b'/')[1]):
|
|
||||||
raise Exception("Taxonomy name already exists in this DMS")
|
|
||||||
taxo = Taxonomy.open_taxdump(o_dms, config['obi']['inputURI'])
|
|
||||||
taxo.write(taxo_name)
|
|
||||||
taxo.close()
|
|
||||||
o_dms.record_command_line(" ".join(sys.argv[1:]))
|
o_dms.record_command_line(" ".join(sys.argv[1:]))
|
||||||
o_dms.close()
|
o_dms.close()
|
||||||
logger("info", "Done.")
|
logger("info", "Done.")
|
||||||
|
Reference in New Issue
Block a user