Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ckanext/doi/lib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from ckan.common import asbool
from ckan.plugins import toolkit
from ckanext.doi.model.crud import DOIQuery
from datacite import DataCiteMDSClient, schema42
from datacite import DataCiteMDSClient, schema43
from datacite.errors import DataCiteError, DataCiteNotFoundError
from datetime import datetime as dt

Expand Down Expand Up @@ -139,9 +139,9 @@ def set_metadata(self, doi, xml_dict):
xml_dict['identifiers'] = [{'identifierType': 'DOI', 'identifier': doi}]

# check that the data is valid, this will raise a JSON schema exception if there are issues
schema42.validator.validate(xml_dict)
schema43.validator.validate(xml_dict)

xml_doc = schema42.tostring(xml_dict)
xml_doc = schema43.tostring(xml_dict)
# create the metadata on datacite
self.client.metadata_post(xml_doc)

Expand Down Expand Up @@ -170,7 +170,7 @@ def check_for_update(self, doi, xml_dict):
if posted_xml is None or posted_xml.strip() == '':
return False
posted_xml_dict = dict(xmltodict.parse(posted_xml).get('resource', {}))
new_xml_dict = dict(xmltodict.parse(schema42.tostring(xml_dict))['resource'])
new_xml_dict = dict(xmltodict.parse(schema43.tostring(xml_dict))['resource'])
if 'identifier' in posted_xml_dict:
del posted_xml_dict['identifier']
has_dates = 'dates' in posted_xml_dict and 'date' in posted_xml_dict['dates']
Expand Down