diff --git a/moai/metadata/datacite.py b/moai/metadata/datacite.py index a2f900a..2d57cae 100644 --- a/moai/metadata/datacite.py +++ b/moai/metadata/datacite.py @@ -98,9 +98,11 @@ def __call__(self, element, metadata): if not isinstance(idf_list, list): idf_list = [idf_list] for identifier in idf_list: - nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) - nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] - creator.append(nameIdf) + if 'Name_Identifier' in identifier: + nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) + if 'Name_Identifier_Scheme' in identifier: + nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] + creator.append(nameIdf) creators.append(creator) datacite.append(creators) @@ -235,9 +237,11 @@ def __call__(self, element, metadata): if not isinstance(idf_list, list): idf_list = [idf_list] for identifier in idf_list: - nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) - nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] - contributor.append(nameIdf) + if 'Name_Identifier' in identifier: + nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) + if 'Name_Identifier_Scheme' in identifier: + nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] + contributor.append(nameIdf) contributors.append(contributor) @@ -270,9 +274,12 @@ def __call__(self, element, metadata): if not isinstance(idf_list, list): idf_list = [idf_list] for identifier in idf_list: - nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) - nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] - contributor.append(nameIdf) + + if 'Name_Identifier' in identifier: + nameIdf = NONE.nameIdentifier(identifier['Name_Identifier']) + if 'Name_Identifier_Scheme' in identifier: + nameIdf.attrib['nameIdentifierScheme'] = identifier['Name_Identifier_Scheme'] + contributor.append(nameIdf) contributors.append(contributor) except KeyError: