aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-01-01 12:58:07 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-01-01 12:58:07 +0100
commit1ca0d81c0d9be268aa952a3dd42fa51e2be7c88c (patch)
tree88e09e7d0b44808a41bbfef7981ac9c118ff5b4b
parent90eb8a70796230b29ec19142482f2503bae55252 (diff)
downloadfatcat-1ca0d81c0d9be268aa952a3dd42fa51e2be7c88c.tar.gz
fatcat-1ca0d81c0d9be268aa952a3dd42fa51e2be7c88c.zip
datacite: avoid more None values
-rw-r--r--python/fatcat_tools/importers/datacite.py8
1 files changed, 4 insertions, 4 deletions
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