Skip to content

Commit

Permalink
Add rudimentary validation
Browse files Browse the repository at this point in the history
  • Loading branch information
ross-spencer committed Aug 12, 2020
1 parent 3f0e1ee commit a477044
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/v1_create_tool_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,22 @@ def create_tool_mets(job, opts):

mets.append_file(fsentry_tree.root_node)

# WELLCOME TODO; We might attempt to perform validation differently
# i.e. via a microservice:
#
# https://github.com/artefactual/archivematica/pull/1590
#
is_valid, _ = metsrw.xsd_validate(mets.serialize())
if not is_valid:
raise ValueError(validates)

# WELLCOME TODO: This is very much a hack until we can solve:
# https://github.com/archivematica/Issues/issues/1272
if create_normative_structmap:
mets = remove_logical_structmap(mets)

mets = etree.ElementTree(mets)
mets.write(
mets_tool_path, pretty_print=True, xml_declaration=True, encoding="UTF-8"
)
mets = etree.ElementTree(mets)
mets.write(
mets_tool_path, pretty_print=True, xml_declaration=True, encoding="UTF-8"
)
else:
mets.write(mets_tool_path, pretty_print=True)

0 comments on commit a477044

Please sign in to comment.