diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-11-20 13:26:12 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-11-20 13:26:39 -0800 |
commit | 7160cf4d43983014289cda7aed076ca1a6b431be (patch) | |
tree | 298a5487e5ab43b85ff68de5fdca91c37e43b054 /python/fatcat_tools/importers | |
parent | 2819f21c8f2e14de67b4a3e62827deda5bcf76a0 (diff) | |
download | fatcat-7160cf4d43983014289cda7aed076ca1a6b431be.tar.gz fatcat-7160cf4d43983014289cda7aed076ca1a6b431be.zip |
doaj: fix update code path (getattr not __dict__)
Also add missing code coverage for update path (disabled by default).
Diffstat (limited to 'python/fatcat_tools/importers')
-rw-r--r-- | python/fatcat_tools/importers/doaj_article.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/python/fatcat_tools/importers/doaj_article.py b/python/fatcat_tools/importers/doaj_article.py index bbc5e969..03752484 100644 --- a/python/fatcat_tools/importers/doaj_article.py +++ b/python/fatcat_tools/importers/doaj_article.py @@ -196,15 +196,14 @@ class DoajArticleImporter(EntityImporter): except fatcat_openapi_client.rest.ApiException as err: if err.status != 404: raise err - # doesn't exist, need to update - return True # then try other ext_id lookups if not existing: for extid_type in ('doi', 'pmid', 'pmcid'): - extid_val = re.ext_ids.__dict__[extid_type] + extid_val = getattr(re.ext_ids, extid_type) if not extid_val: continue + #print(f" lookup release type: {extid_type} val: {extid_val}") try: existing = self.api.lookup_release(**{extid_type: extid_val}) except fatcat_openapi_client.rest.ApiException as err: @@ -215,7 +214,7 @@ class DoajArticleImporter(EntityImporter): warn_str = f"unexpected DOAJ ext_id match after lookup failed doaj={re.ext_ids.doaj} ident={existing.ident}" warnings.warn(warn_str) self.counts["skip-doaj-id-mismatch"] += 1 - return None + return False break # TODO: in the future could do fuzzy match here, eg using elasticsearch |