Commit 7b5a77a9 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed wrong mongodb key for doi metadata.

parent 859715d0
Pipeline #94805 passed with stages
in 23 minutes and 16 seconds
......@@ -24,7 +24,7 @@ import xml.etree.ElementTree as ET
import datetime
import requests
from requests.auth import HTTPBasicAuth
from mongoengine import Document, StringField, DateTimeField, BinaryField
from mongoengine import Document, StringField, DateTimeField
from mongoengine.errors import NotUniqueError
from nomad.datamodel import User
......@@ -70,7 +70,7 @@ class DOI(Document):
doi_url = StringField()
state = StringField()
create_time = DateTimeField()
matadata_xml = BinaryField()
metadata_xml = StringField()
def create(title: str, user: User) -> 'DOI':
......@@ -124,7 +124,7 @@ class DOI(Document):
_xml(mds_resource, 'publisher', 'NOMAD Repository')
_xml(mds_resource, 'publicationYear', str(
doi.metadata_xml = ET.tostring(mds_resource, encoding='UTF-8', method='xml')
doi.metadata_xml = ET.tostring(mds_resource, encoding='UTF-8', method='xml').decode('utf-8')
return doi
......@@ -146,7 +146,7 @@ class DOI(Document):
response =
headers={'Content-Type': 'application/xml;charset=UTF-8'},
data=self.metadata_xml, **_requests_args())
data=self.metadata_xml.encode('utf-8'), **_requests_args())
if self.__handle_datacite_errors(response, 'create draft DOI'):
self.state = 'draft'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment