aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web')
-rw-r--r--python/fatcat_web/entity_helpers.py21
-rw-r--r--python/fatcat_web/templates/container_lookup.html7
-rw-r--r--python/fatcat_web/templates/home.html6
-rw-r--r--python/fatcat_web/templates/release_view.html3
4 files changed, 25 insertions, 12 deletions
diff --git a/python/fatcat_web/entity_helpers.py b/python/fatcat_web/entity_helpers.py
index 520bb832..4d13da43 100644
--- a/python/fatcat_web/entity_helpers.py
+++ b/python/fatcat_web/entity_helpers.py
@@ -1,6 +1,6 @@
from flask import abort
-from fatcat_openapi_client.rest import ApiException
+from fatcat_openapi_client.rest import ApiException, ApiValueError
from fatcat_tools.transforms import *
from fatcat_web import app, api
from fatcat_web.search import get_elastic_container_stats, get_elastic_container_random_releases
@@ -74,8 +74,13 @@ def enrich_release_entity(entity):
ref.extra['unstructured'] = strip_extlink_xml(ref.extra['unstructured'])
# author list to display; ensure it's sorted by index (any othors with
# index=None go to end of list)
- authors = [c for c in entity.contribs if c.role in ('author', None)]
+ authors = [c for c in entity.contribs if
+ c.role in ('author', None) and
+ (c.surname or c.raw_name or (c.creator and c.creator.surname))
+ ]
entity._authors = sorted(authors, key=lambda c: (c.index == None and 99999999) or c.index)
+ # need authors, title for citeproc to work
+ entity._can_citeproc = bool(entity._authors) and bool(entity.title)
if entity.abstracts:
# hack to show plain text instead of latex abstracts
if 'latex' in entity.abstracts[0].mimetype:
@@ -118,6 +123,8 @@ def generic_get_entity(entity_type, ident):
raise NotImplementedError
except ApiException as ae:
abort(ae.status)
+ except ApiValueError:
+ abort(400)
def generic_get_entity_revision(entity_type, revision_id):
try:
@@ -139,6 +146,8 @@ def generic_get_entity_revision(entity_type, revision_id):
raise NotImplementedError
except ApiException as ae:
abort(ae.status)
+ except ApiValueError:
+ abort(400)
def generic_get_editgroup_entity(editgroup, entity_type, ident):
if entity_type == 'container':
@@ -167,6 +176,12 @@ def generic_get_editgroup_entity(editgroup, entity_type, ident):
# couldn't find relevant edit in this editgroup
abort(404)
- entity = generic_get_entity_revision(entity_type, revision_id)
+ try:
+ entity = generic_get_entity_revision(entity_type, revision_id)
+ except ApiException as ae:
+ abort(ae.status)
+ except ApiValueError:
+ abort(400)
+
entity.ident = ident
return entity, edit
diff --git a/python/fatcat_web/templates/container_lookup.html b/python/fatcat_web/templates/container_lookup.html
index e6fb860c..798e5587 100644
--- a/python/fatcat_web/templates/container_lookup.html
+++ b/python/fatcat_web/templates/container_lookup.html
@@ -20,10 +20,9 @@ search for an existing record missing that identifier, or create a new container
entity.
{% if lookup_key == "issnl" %}
<p>You can check if it is a registered ISSN-L by visiting:
-<b><a href="https://portal.issn.org/{{ lookup_value
-}}">https://portal.issn.org/{{ lookup_value }}</a></b>. If this is a valid
-electronic or print ISSN, but not the ISSN-L for the container, you need to use
-the indicated "linking" ISSN.
+<b><a href="https://portal.issn.org/api/search?search[]=MUST=allissnbis={{ lookup_value }}">https://portal.issn.org/api/search?search[]=MUST=allissnbis={{ lookup_value }}</a></b>.
+If this is a valid electronic or print ISSN, but not the ISSN-L for the
+container, you need to use the indicated "linking" ISSN.
{% elif lookup_key == "wikidata_qid" %}
<p>You can check if it is a real Wikidata entity by visiting:
<b><a href="https://www.wikidata.org/wiki/{{ lookup_value }}">https://www.wikidata.org/wiki/{{ lookup_value }}</a></b>
diff --git a/python/fatcat_web/templates/home.html b/python/fatcat_web/templates/home.html
index 0039e3a7..698230d3 100644
--- a/python/fatcat_web/templates/home.html
+++ b/python/fatcat_web/templates/home.html
@@ -35,17 +35,17 @@
<div class="row">
<div class="four wide mobile three wide center aligned column">
<a href="/stats" style="color: black;">
- <h4>96,947,165<br>Papers</h4>
+ <h4>106,283,000<br>Papers</h4>
</a>
</div>
<div class="four wide mobile three wide center aligned column">
<a href="/stats" style="color: black;">
- <h4>18,117,429<br>Fulltext</h4>
+ <h4>23,036,825<br>Fulltext</h4>
</a>
</div>
<div class="four wide mobile three wide center aligned column">
<a href="/stats" style="color: black;">
- <h4>140,085<br>Journals</h4>
+ <h4>148,757<br>Journals</h4>
</a>
</div>
</div>
diff --git a/python/fatcat_web/templates/release_view.html b/python/fatcat_web/templates/release_view.html
index 961b4759..d7c4e76e 100644
--- a/python/fatcat_web/templates/release_view.html
+++ b/python/fatcat_web/templates/release_view.html
@@ -388,8 +388,7 @@ accessible version.
<br>grouping other versions (eg, pre-print) and variants of this release
</div>
-{# this restriction, for CSL-JSON generation, rules out almost everything #}
-{% if release.contribs and release.contribs[0].creator_id %}
+{% if release._can_citeproc %}
<div class="ui segment attached accordion">
<div class="title" style="padding: 0px;">
<i class="dropdown icon"></i><b>Cite This Release</b>