From d24f2569d791fc0145639115aed4ccd6bed03466 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 25 Jul 2018 19:33:24 -0700 Subject: test fixes --- python/fatcat/crossref_importer.py | 16 ++++++++++++++-- python/fatcat/routes.py | 3 +-- python/fatcat/templates/release_view.html | 2 +- 3 files changed, 16 insertions(+), 5 deletions(-) (limited to 'python') diff --git a/python/fatcat/crossref_importer.py b/python/fatcat/crossref_importer.py index ca31d241..d3e525a4 100644 --- a/python/fatcat/crossref_importer.py +++ b/python/fatcat/crossref_importer.py @@ -73,16 +73,27 @@ class FatcatCrossrefImporter(FatcatImporter): return None except: year = None + extra = dict(crossref=rm) + if rm.get('DOI') != None: + extra['doi'] = rm.get('DOI').lower() refs.append(fatcat_client.ReleaseRef( index=i+1, - target_release_id=None, # TODO: DOI lookup: rm.get("DOI", None), + # doing lookups would be a second import pass + target_release_id=None, # unreliable for crossref: key=rm['key'].split('|')[-1], year=year, container_title=rm.get('volume-title'), title=rm.get('title'), locator=rm.get('first-page'), # TODO: just dump JSON somewhere here? - extra=rm.get('unstructured'))) + extra=dict(crossref=rm))) + + # abstracts + abstracts = [] + if obj.get('abstract') != None: + abstracts.append(fatcat_client.ReleaseEntityAbstracts( + mimetype="application/xml+jats", + content=obj.get('abstract'))) # release extra = dict(crossref={ @@ -104,6 +115,7 @@ class FatcatCrossrefImporter(FatcatImporter): issue=obj.get('issue'), volume=obj.get('volume'), pages=obj.get('page'), + abstracts=abstracts, extra=extra) return (re, ce) diff --git a/python/fatcat/routes.py b/python/fatcat/routes.py index 209a7676..965040f5 100644 --- a/python/fatcat/routes.py +++ b/python/fatcat/routes.py @@ -17,7 +17,7 @@ def container_history(ident): history = api.get_container_history(ident) except ApiException as ae: abort(ae.status) - print(history) + #print(history) return render_template('entity_history.html', page_title=entity.name, entity_type="container", @@ -262,7 +262,6 @@ def editgroup_view(ident): try: entity = api.get_editgroup(str(ident)) except ApiException as ae: - print(ae.body) abort(ae.status) return render_template('editgroup_view.html', editgroup=entity) diff --git a/python/fatcat/templates/release_view.html b/python/fatcat/templates/release_view.html index d7da7080..dd92f611 100644 --- a/python/fatcat/templates/release_view.html +++ b/python/fatcat/templates/release_view.html @@ -150,7 +150,7 @@ This release citing other releases.
  • {% if ref.extra != None %}{{ ref.extra }}{% else %}unknown{% endif %} {% if ref.target_release_id != None %} (fatcat release) - {% else if ref.extra.doi != None %} + {% elif ref.extra != None and ref.extra.doi != None %} (DOI: {{ ref.extra.doi }}) {% endif %} {% endfor %} -- cgit v1.2.3