Skip to content

Commit

Permalink
wip: make doi optional in pds4 label
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas loubrieu committed Jul 21, 2022
1 parent 2412b9d commit 0c3e030
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/pds_doi_service/core/actions/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,16 @@ def _update_dois(self, dois):
updated_dois = []

for updated_doi in dois:
if not updated_doi.doi:
raise RuntimeError(
f"Record provided for identifier {updated_doi.pds_identifier} does not have a DOI assigned.\n"
"Use the Reserve action to acquire a DOI for the record before attempting to update it."
)
if not updated_doi.doi :
if self._force:
updated_doi.doi = self._record_service
else:
raise WarningDOIException(
f"Record provided for identifier {updated_doi.pds_identifier} does not have a DOI assigned in the label.\n"
"Use the Reserve action to acquire a DOI and add it in the Citation_Information/doi tag \n"
"if the version of PDS4 information model you are using allows it."
)


# Get the record from the transaction database for the current DOI value
transaction_record = self._list_action.transaction_for_doi(updated_doi.doi)
Expand Down

0 comments on commit 0c3e030

Please sign in to comment.