summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/routes.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-31 17:10:33 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-02-01 11:41:01 -0800
commita24e3a67987e7a070eca562ce1cf30a59c206e06 (patch)
treef5afe17774049de7497f7b2aed69d11d20d8cb01 /python/fatcat_web/routes.py
parent6910220ad899c3ae8c9c37c578aa116c60cd2855 (diff)
downloadfatcat-a24e3a67987e7a070eca562ce1cf30a59c206e06.tar.gz
fatcat-a24e3a67987e7a070eca562ce1cf30a59c206e06.zip
tweaks and fixes for new container extra schema
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r--python/fatcat_web/routes.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 926d5340..21f81eae 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -8,6 +8,7 @@ from fatcat_web import app, api, auth_api, priv_api
from fatcat_web.auth import handle_token_login, handle_logout, load_user, handle_ia_xauth
from fatcat_client.rest import ApiException
from fatcat_web.search import do_search
+from fatcat_tools.transforms import *
### Views ###################################################################
@@ -86,6 +87,7 @@ def container_view(ident):
return redirect('/container/{}'.format(entity.redirect))
if entity.state == "deleted":
return render_template('deleted_entity.html', entity=entity)
+ entity.es = container_to_elasticsearch(entity, force_bool=False)
return render_template('container_view.html', container=entity)
@app.route('/creator/<ident>/history', methods=['GET'])
@@ -236,17 +238,18 @@ def release_edit_view(ident):
@app.route('/release/<ident>', methods=['GET'])
def release_view(ident):
try:
- entity = api.get_release(ident)
- files = api.get_release_files(ident)
- container = None
- if entity.container_id is not None:
- container = api.get_container(entity.container_id)
+ entity = api.get_release(ident, expand="container,files,filesets,webcaptures")
+ files = entity.files
+ container = entity.container
except ApiException as ae:
abort(ae.status)
if entity.state == "redirect":
return redirect('/release/{}'.format(entity.redirect))
if entity.state == "deleted":
return render_template('deleted_entity.html', entity=entity)
+ if entity.container:
+ entity.container.es = container_to_elasticsearch(entity.container, force_bool=False)
+ entity.es = release_to_elasticsearch(entity, force_bool=False)
authors = [c for c in entity.contribs if c.role in ('author', None)]
authors = sorted(authors, key=lambda c: c.index)
for fe in files: