From ec82404f0d0ad6b92491a1cb90a823d421857348 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 26 Mar 2020 13:58:32 -0700 Subject: datacite: nameIdentifier corner case Works around a bug in production: AttributeError: 'NoneType' object has no attribute 'replace' (datacite.py:724) NOTE: there are no tests for this code path --- python/fatcat_tools/importers/datacite.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py index db4709c2..5b736787 100644 --- a/python/fatcat_tools/importers/datacite.py +++ b/python/fatcat_tools/importers/datacite.py @@ -721,7 +721,8 @@ class DataciteImporter(EntityImporter): name_scheme = nid.get('nameIdentifierScheme', '') or '' if not name_scheme.lower() == "orcid": continue - orcid = nid.get('nameIdentifier', '').replace('https://orcid.org/', '') + orcid = nid.get('nameIdentifier') or '' + orcid = orcid.replace('https://orcid.org/', '') if not orcid: continue creator_id = self.lookup_orcid(orcid) -- cgit v1.2.3