diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-03 14:01:33 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-03 16:46:07 -0700 |
commit | 36cedfde374a2643396b070d3116e4b568500e14 (patch) | |
tree | b199868b325897ea5dc2b065192a7eba2daf9c6b /python/fatcat_tools/importers/crossref.py | |
parent | 5d29d1336afc90d3575a0379a9e9d9bdac8d1856 (diff) | |
download | fatcat-36cedfde374a2643396b070d3116e4b568500e14.tar.gz fatcat-36cedfde374a2643396b070d3116e4b568500e14.zip |
more involved type wrangling and fixes for importers
Diffstat (limited to 'python/fatcat_tools/importers/crossref.py')
-rw-r--r-- | python/fatcat_tools/importers/crossref.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/python/fatcat_tools/importers/crossref.py b/python/fatcat_tools/importers/crossref.py index 816f6ab6..a41e2bf5 100644 --- a/python/fatcat_tools/importers/crossref.py +++ b/python/fatcat_tools/importers/crossref.py @@ -269,18 +269,19 @@ class CrossrefImporter(EntityImporter): else: index = None raw_affiliation = None - if am.get("affiliation"): - if len(am.get("affiliation")) > 0: - raw_affiliation = am.get("affiliation")[0]["name"] - if len(am.get("affiliation")) > 1: + affiliation_list = am.get("affiliation") or [] + if affiliation_list and len(affiliation_list) > 0: + raw_affiliation = affiliation_list[0]["name"] + if len(affiliation_list) > 1: # note: affiliation => more_affiliations extra["more_affiliations"] = [ - clean(a["name"]) for a in am.get("affiliation")[1:] + clean(a["name"]) for a in affiliation_list[1:] ] if am.get("sequence") and am.get("sequence") != "additional": extra["seq"] = clean(am.get("sequence")) assert ctype in ("author", "editor", "translator") raw_name = clean(raw_name) + # TODO: what if 'raw_name' is None? contribs.append( ReleaseContrib( creator_id=creator_id, |