aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/README_codegen.md3
-rw-r--r--python/fatcat/routes.py9
-rw-r--r--python/fatcat/templates/creator_view.html12
-rw-r--r--python/fatcat/templates/release_view.html15
-rw-r--r--python/fatcat/templates/work_view.html9
5 files changed, 39 insertions, 9 deletions
diff --git a/python/README_codegen.md b/python/README_codegen.md
index cb2c230e..e259c16f 100644
--- a/python/README_codegen.md
+++ b/python/README_codegen.md
@@ -82,12 +82,15 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**create_work_batch**](docs/DefaultApi.md#create_work_batch) | **POST** /work/batch |
*DefaultApi* | [**get_container**](docs/DefaultApi.md#get_container) | **GET** /container/{id} |
*DefaultApi* | [**get_creator**](docs/DefaultApi.md#get_creator) | **GET** /creator/{id} |
+*DefaultApi* | [**get_creator_releases**](docs/DefaultApi.md#get_creator_releases) | **GET** /creator/{id}/releases |
*DefaultApi* | [**get_editgroup**](docs/DefaultApi.md#get_editgroup) | **GET** /editgroup/{id} |
*DefaultApi* | [**get_editor**](docs/DefaultApi.md#get_editor) | **GET** /editor/{username} |
*DefaultApi* | [**get_editor_changelog**](docs/DefaultApi.md#get_editor_changelog) | **GET** /editor/{username}/changelog |
*DefaultApi* | [**get_file**](docs/DefaultApi.md#get_file) | **GET** /file/{id} |
*DefaultApi* | [**get_release**](docs/DefaultApi.md#get_release) | **GET** /release/{id} |
+*DefaultApi* | [**get_release_files**](docs/DefaultApi.md#get_release_files) | **GET** /release/{id}/files |
*DefaultApi* | [**get_work**](docs/DefaultApi.md#get_work) | **GET** /work/{id} |
+*DefaultApi* | [**get_work_releases**](docs/DefaultApi.md#get_work_releases) | **GET** /work/{id}/releases |
*DefaultApi* | [**lookup_container**](docs/DefaultApi.md#lookup_container) | **GET** /container/lookup |
*DefaultApi* | [**lookup_creator**](docs/DefaultApi.md#lookup_creator) | **GET** /creator/lookup |
*DefaultApi* | [**lookup_file**](docs/DefaultApi.md#lookup_file) | **GET** /file/lookup |
diff --git a/python/fatcat/routes.py b/python/fatcat/routes.py
index ab7d2c92..47e5863e 100644
--- a/python/fatcat/routes.py
+++ b/python/fatcat/routes.py
@@ -35,9 +35,10 @@ def container_create():
def creator_view(ident):
try:
entity = api.get_creator(str(ident))
+ releases = api.get_creator_releases(str(ident))
except ApiException as ae:
abort(ae.status)
- return render_template('creator_view.html', creator=entity)
+ return render_template('creator_view.html', creator=entity, releases=releases)
@app.route('/file/<uuid:ident>', methods=['GET'])
def file_view(ident):
@@ -51,11 +52,12 @@ def file_view(ident):
def release_view(ident):
try:
entity = api.get_release(str(ident))
+ files = api.get_release_files(str(ident))
except ApiException as ae:
abort(ae.status)
authors = [c for c in entity.contribs if c.role in ('author', None)]
authors = sorted(authors, key=lambda c: c.index)
- return render_template('release_view.html', release=entity, authors=authors)
+ return render_template('release_view.html', release=entity, authors=authors, files=files)
#@app.route('/release/<uuid:ident>/changelog', methods=['GET'])
#def release_changelog(ident):
@@ -74,9 +76,10 @@ def release_view(ident):
def work_view(ident):
try:
entity = api.get_work(str(ident))
+ releases = api.get_work_releases(str(ident))
except ApiException as ae:
abort(ae.status)
- return render_template('work_view.html', work=entity)
+ return render_template('work_view.html', work=entity, releases=releases)
@app.route('/work/create', methods=['GET'])
def work_create():
diff --git a/python/fatcat/templates/creator_view.html b/python/fatcat/templates/creator_view.html
index 210242aa..24dfdc56 100644
--- a/python/fatcat/templates/creator_view.html
+++ b/python/fatcat/templates/creator_view.html
@@ -22,4 +22,16 @@ Raw JSON Object:
{{ creator }}
-->
+{% if releases != [] %}
+Releases this creator has contributed to:
+<ul>
+ {% for release in releases %}
+ <li>"{{ release.title }}", a {{ release.release_type }} published {{ release.release_date }} as <code>{{ release.release_status }}</code>.
+ <br><a href="/release/{{ release.ident }}"><code>{{ release.ident }}</code></a>
+ {% endfor %}
+</ul>
+{% else %}
+This creator has not contributed to any releases.
+{% endif %}
+
{% endblock %}
diff --git a/python/fatcat/templates/release_view.html b/python/fatcat/templates/release_view.html
index 6572919e..09a0b97b 100644
--- a/python/fatcat/templates/release_view.html
+++ b/python/fatcat/templates/release_view.html
@@ -41,6 +41,19 @@ Raw JSON Object:
-->
<br>
+{% if files != [] %}
+<p>Files believed to represent this release:
+<ul>
+ {% for file in files %}
+ <li><a href="/file/{{ file.ident }}">{{ file.sha1}}</a> ({{ file.size }} bytes), at <a href="{{ file.url }}">{{ file.url }}</a>
+ {% endfor %}
+</ul>
+{% else %}
+<p>There are no known files associated with this release (you could try other
+releases for this work?).
+{% endif %}
+
+<br>
{% if release.contribs.size != 0 %}
<p>Full list of contributors (not just authors):
<table>
@@ -76,6 +89,4 @@ Raw JSON Object:
<p>No reference list available.
{% endif %}
-
-
{% endblock %}
diff --git a/python/fatcat/templates/work_view.html b/python/fatcat/templates/work_view.html
index 1a81d456..8fd384d6 100644
--- a/python/fatcat/templates/work_view.html
+++ b/python/fatcat/templates/work_view.html
@@ -20,11 +20,12 @@ still reference the same underlying "work".
<br>
-{% if releases %}
+{% if releases != [] %}
<ul>
-{% for r in releases %}
- <ul><a href="/release/{{ r.ident }}">{{ r.title }}</a> ({{ y.release_type }} - {{ y.date }})
-{% endfor %}
+ {% for release in releases %}
+ <li>"{{ release.title }}", a {{ release.release_type }} published {{ release.release_date }} as <code>{{ release.release_status }}</code>.
+ <br><a href="/release/{{ release.ident }}"><code>{{ release.ident }}</code></a>
+ {% endfor %}
</ul>
{% else %}
<p>There are no known releases associated with this work.