aboutsummaryrefslogtreecommitdiffstats
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/README_codegen.md6
-rw-r--r--python/fatcat/importer_common.py9
-rw-r--r--python/fatcat/routes.py16
-rw-r--r--python/fatcat/templates/container_view.html3
-rw-r--r--python/fatcat/templates/creator_view.html3
-rw-r--r--python/fatcat/templates/editor_view.html3
-rw-r--r--python/fatcat/templates/file_view.html3
-rw-r--r--python/fatcat/templates/release_view.html3
-rw-r--r--python/fatcat/templates/work_view.html3
-rw-r--r--python/tests/routes.py8
10 files changed, 32 insertions, 25 deletions
diff --git a/python/README_codegen.md b/python/README_codegen.md
index 71e56fa0..9d9bdb52 100644
--- a/python/README_codegen.md
+++ b/python/README_codegen.md
@@ -52,7 +52,7 @@ from fatcat_client.rest import ApiException
from pprint import pprint
# create an instance of the API class
api_instance = fatcat_client.DefaultApi()
-id = 789 # int |
+id = 'id_example' # str |
try:
api_response = api_instance.accept_editgroup(id)
@@ -88,8 +88,8 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**get_creator_history**](docs/DefaultApi.md#get_creator_history) | **GET** /creator/{id}/history |
*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_editor**](docs/DefaultApi.md#get_editor) | **GET** /editor/{id} |
+*DefaultApi* | [**get_editor_changelog**](docs/DefaultApi.md#get_editor_changelog) | **GET** /editor/{id}/changelog |
*DefaultApi* | [**get_file**](docs/DefaultApi.md#get_file) | **GET** /file/{id} |
*DefaultApi* | [**get_file_history**](docs/DefaultApi.md#get_file_history) | **GET** /file/{id}/history |
*DefaultApi* | [**get_release**](docs/DefaultApi.md#get_release) | **GET** /release/{id} |
diff --git a/python/fatcat/importer_common.py b/python/fatcat/importer_common.py
index 6f867f70..9d495aa7 100644
--- a/python/fatcat/importer_common.py
+++ b/python/fatcat/importer_common.py
@@ -27,19 +27,22 @@ class FatcatImporter:
def process_source(self, source, group_size=100):
"""Creates and auto-accepts editgroup every group_size rows"""
- eg = self.api.create_editgroup(fatcat_client.Editgroup(editor_id=1))
+ eg = self.api.create_editgroup(
+ fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae'))
for i, row in enumerate(source):
self.create_row(row, editgroup_id=eg.id)
if i > 0 and (i % group_size) == 0:
self.api.accept_editgroup(eg)
- eg = self.api.create_editgroup(fatcat_client.Editgroup(editor_id=1))
+ eg = self.api.create_editgroup(
+ fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae'))
if i == 0 or (i % group_size) != 0:
self.api.accept_editgroup(eg.id)
def process_batch(self, source, size=50):
"""Reads and processes in batches (not API-call-per-)"""
for rows in grouper(source, size):
- eg = self.api.create_editgroup(fatcat_client.Editgroup(editor_id=1))
+ eg = self.api.create_editgroup(
+ fatcat_client.Editgroup(editor_id='aaaaaaaaaaaabkvkaaaaaaaaae'))
self.create_batch(rows, eg.id)
self.api.accept_editgroup(eg.id)
diff --git a/python/fatcat/routes.py b/python/fatcat/routes.py
index c92f6493..209a7676 100644
--- a/python/fatcat/routes.py
+++ b/python/fatcat/routes.py
@@ -257,7 +257,7 @@ def editgroup_current():
#eg = api.get_or_create_editgroup()
#return redirect('/editgroup/{}'.format(eg.id))
-@app.route('/editgroup/<int:ident>', methods=['GET'])
+@app.route('/editgroup/<ident>', methods=['GET'])
def editgroup_view(ident):
try:
entity = api.get_editgroup(str(ident))
@@ -266,15 +266,15 @@ def editgroup_view(ident):
abort(ae.status)
return render_template('editgroup_view.html', editgroup=entity)
-@app.route('/editor/<username>', methods=['GET'])
-def editor_view(username):
- entity = api.get_editor(username)
+@app.route('/editor/<ident>', methods=['GET'])
+def editor_view(ident):
+ entity = api.get_editor(ident)
return render_template('editor_view.html', editor=entity)
-@app.route('/editor/<username>/changelog', methods=['GET'])
-def editor_changelog(username):
- editor = api.get_editor(username)
- changelog_entries = api.get_editor_changelog(username)
+@app.route('/editor/<ident>/changelog', methods=['GET'])
+def editor_changelog(ident):
+ editor = api.get_editor(ident)
+ changelog_entries = api.get_editor_changelog(ident)
return render_template('editor_changelog.html', editor=editor,
changelog_entries=changelog_entries)
diff --git a/python/fatcat/templates/container_view.html b/python/fatcat/templates/container_view.html
index e65b65b1..bcdbfc95 100644
--- a/python/fatcat/templates/container_view.html
+++ b/python/fatcat/templates/container_view.html
@@ -89,7 +89,8 @@ Raw Object:
</div><div class="ui segment attached">
<b>Fatcat Bits</b>
-<p>Revision #{{ container.revision }}. State is "{{ container.state }}"
+<p>State is "{{ container.state }}". Revision:
+<br><small><code>{{ container.revision }}</code></small>
<br><a href="https://api.qa.fatcat.wiki/v0/container/{{ container.ident }}">As JSON object via API</a>
</div>
diff --git a/python/fatcat/templates/creator_view.html b/python/fatcat/templates/creator_view.html
index 91c0ee52..3047a909 100644
--- a/python/fatcat/templates/creator_view.html
+++ b/python/fatcat/templates/creator_view.html
@@ -63,7 +63,8 @@ Raw Object:
</div><div class="ui segment attached">
<b>Fatcat Bits</b>
-<p>Revision #{{ creator.revision }}. State is "{{ creator.state }}"
+<p>State is "{{ creator.state }}". Revision:
+<br><small><code>{{ creator.revision }}</code></small>
<br><a href="https://api.qa.fatcat.wiki/v0/creator/{{ creator.ident }}">As JSON object via API</a>
</div>
diff --git a/python/fatcat/templates/editor_view.html b/python/fatcat/templates/editor_view.html
index f58b85b5..c9b61f5d 100644
--- a/python/fatcat/templates/editor_view.html
+++ b/python/fatcat/templates/editor_view.html
@@ -7,7 +7,6 @@
</div>
</h1>
-<p>Is Admin? {{ editor.is_admin }}
-<p><a href="/editor/{{ editor.username }}/changelog">Changelog</a>
+<p><b><a href="/editor/{{ editor.id }}/changelog">View editor's changelog</a></b>
{% endblock %}
diff --git a/python/fatcat/templates/file_view.html b/python/fatcat/templates/file_view.html
index 8ded9ced..54a6c18a 100644
--- a/python/fatcat/templates/file_view.html
+++ b/python/fatcat/templates/file_view.html
@@ -90,7 +90,8 @@ Raw Object:
{% endif %}
<b>Fatcat Bits</b>
-<p>Revision #{{ file.revision }}. State is "{{ file.state }}"
+<p>State is "{{ file.state }}". Revision:
+<br><small><code>{{ file.revision }}</code></small>
<br><a href="https://api.qa.fatcat.wiki/v0/file/{{ file.ident }}">As JSON object via API</a>
</div>
diff --git a/python/fatcat/templates/release_view.html b/python/fatcat/templates/release_view.html
index 22a45e15..b3fe0aa6 100644
--- a/python/fatcat/templates/release_view.html
+++ b/python/fatcat/templates/release_view.html
@@ -223,7 +223,8 @@ This release citing other releases.
</div><div class="ui segment attached">
<b>Fatcat Bits</b>
-<p>Revision #{{ release.revision }}. State is "{{ release.state }}"
+<p>State is "{{ release.state }}". Revision:
+<br><small><code>{{ release.revision }}</code></small>
<br><a href="https://api.qa.fatcat.wiki/v0/release/{{ release.ident }}">As JSON object via API</a>
</div>
diff --git a/python/fatcat/templates/work_view.html b/python/fatcat/templates/work_view.html
index ced19397..afee760e 100644
--- a/python/fatcat/templates/work_view.html
+++ b/python/fatcat/templates/work_view.html
@@ -56,7 +56,8 @@ still reference the same underlying "work".
</div><div class="ui segment attached">
<b>Fatcat Bits</b>
-<p>Revision #{{ work.revision }}. State is "{{ work.state }}"
+<p>State is "{{ work.state }}". Revision:
+<br><small><code>{{ work.revision }}</code></small>
<br><a href="https://api.qa.fatcat.wiki/v0/work/{{ work.ident }}">As JSON object via API</a>
</div>
diff --git a/python/tests/routes.py b/python/tests/routes.py
index 3391596e..8607e7c0 100644
--- a/python/tests/routes.py
+++ b/python/tests/routes.py
@@ -99,10 +99,10 @@ def test_all_views(app):
rv = app.get('/work/create')
assert rv.status_code == 404
- rv = app.get('/editgroup/1')
+ rv = app.get('/editgroup/aaaaaaaaaaaabo53aaaaaaaaae')
assert rv.status_code == 200
- rv = app.get('/editgroup/99999999')
+ rv = app.get('/editgroup/ccccccccccccccccccccccccca')
print(rv)
print(rv.data)
assert rv.status_code == 404
@@ -110,10 +110,10 @@ def test_all_views(app):
#rv = app.get('/editgroup/current')
#assert rv.status_code == 302
- rv = app.get('/editor/admin')
+ rv = app.get('/editor/aaaaaaaaaaaabkvkaaaaaaaaae')
assert rv.status_code == 200
- rv = app.get('/editor/admin/changelog')
+ rv = app.get('/editor/aaaaaaaaaaaabkvkaaaaaaaaae/changelog')
assert rv.status_code == 200
rv = app.get('/stats')