diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-07-30 10:41:23 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-07-30 10:41:25 -0700 |
commit | a2d6fb28852f6575e5c69b9cb0ebf7979af6f378 (patch) | |
tree | cdd6abd44cbfed048b757d7c1ff51579f3d7edcd /fatcat_scholar/schema.py | |
parent | 6c87ad4be3faaba936791c57d09d2989dde4ff46 (diff) | |
download | fatcat-scholar-a2d6fb28852f6575e5c69b9cb0ebf7979af6f378.tar.gz fatcat-scholar-a2d6fb28852f6575e5c69b9cb0ebf7979af6f378.zip |
transform: catch more cases of null extra
Also correctly pull issne/issnp from container.extra, not release.extra.
Diffstat (limited to 'fatcat_scholar/schema.py')
-rw-r--r-- | fatcat_scholar/schema.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/fatcat_scholar/schema.py b/fatcat_scholar/schema.py index e08ba6f..41598ba 100644 --- a/fatcat_scholar/schema.py +++ b/fatcat_scholar/schema.py @@ -295,17 +295,17 @@ def es_biblio_from_release(release: ReleaseEntity) -> ScholarBiblio: container_ident = release.container.ident container_type = release.container.container_type container_issnl = release.container.issnl - issns = [ - container_issnl, - ] - if release.extra.get("issne"): - issns.append(release.extra["issne"]) - if release.extra.get("issnp"): - issns.append(release.extra["issnp"]) + issns = [] + if container_issnl: + issns.append(container_issnl) + if release.container.extra and release.container.extra.get("issne"): + issns.append(release.container.extra["issne"]) + if release.container.extra and release.container.extra.get("issnp"): + issns.append(release.container.extra["issnp"]) issns = list(set(issns)) else: - publisher = release.extra.get("publisher") - container_name = release.extra.get("container_name") + publisher = release.extra and release.extra.get("publisher") + container_name = release.extra and release.extra.get("container_name") container_original_name = None container_ident = None container_type = None @@ -383,7 +383,7 @@ def es_release_from_release(release: ReleaseEntity) -> ScholarRelease: container_issnl = release.container.issnl container_type = release.container.container_type else: - container_name = release.extra.get("container_name") + container_name = release.extra and release.extra.get("container_name") container_ident = None container_issnl = None container_type = None |