From 1ca0d81c0d9be268aa952a3dd42fa51e2be7c88c Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Wed, 1 Jan 2020 12:58:07 +0100 Subject: datacite: avoid more None values --- python/fatcat_tools/importers/datacite.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'python') diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py index 854085b8..37fceb1c 100644 --- a/python/fatcat_tools/importers/datacite.py +++ b/python/fatcat_tools/importers/datacite.py @@ -524,9 +524,9 @@ class DataciteImporter(EntityImporter): for desc in descs: if not desc.get('descriptionType') == 'Abstract': continue - if len(desc.get('description', '')) < 10: + if len(desc.get('description', '') or '') < 10: continue - text = desc.get('description') + text = desc.get('description', '') if len(text) > MAX_ABSTRACT_LENGTH: text = text[:MAX_ABSTRACT_LENGTH] + " [...]" lang = None @@ -556,10 +556,10 @@ class DataciteImporter(EntityImporter): relIds = attributes.get('relatedIdentifiers', []) or [] for rel in relIds: - if not rel.get('relationType') == 'References': + if not rel.get('relationType', '') == 'References': continue ref_extra = dict() - if rel.get('relatedIdentifierType') == 'DOI': + if rel.get('relatedIdentifierType', '') == 'DOI': ref_extra['doi'] = rel.get('relatedIdentifier') if not ref_extra: ref_extra = None -- cgit v1.2.3