aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-07-28 17:05:05 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-07-28 17:29:44 -0700
commitaa044a4a1ea1b423d46ade63d6a66dcf62bd80b5 (patch)
tree860e94cb0fb17a87d1d1425465b699dc2d22a546
parentab80084f1cd90faf5e069edc4203668c81e75d63 (diff)
downloadfatcat-aa044a4a1ea1b423d46ade63d6a66dcf62bd80b5.tar.gz
fatcat-aa044a4a1ea1b423d46ade63d6a66dcf62bd80b5.zip
convert some API errors from abort() to raise
-rw-r--r--python/fatcat_web/editing_routes.py14
-rw-r--r--python/fatcat_web/routes.py14
2 files changed, 14 insertions, 14 deletions
diff --git a/python/fatcat_web/editing_routes.py b/python/fatcat_web/editing_routes.py
index 44000b1a..e66f29c9 100644
--- a/python/fatcat_web/editing_routes.py
+++ b/python/fatcat_web/editing_routes.py
@@ -25,7 +25,7 @@ def form_editgroup_get_or_create(api, edit_form):
edit_form.editgroup_id.errors.append("Editgroup does not exist")
return None
app.log.warning(ae)
- abort(ae.status)
+ raise ae
if eg.changelog_index:
edit_form.editgroup_id.errors.append("Editgroup has already been accepted")
return None
@@ -36,7 +36,7 @@ def form_editgroup_get_or_create(api, edit_form):
Editgroup(description=edit_form.editgroup_description.data or None))
except ApiException as ae:
app.log.warning(ae)
- abort(ae.status)
+ raise ae
# set this session editgroup_id
flash('Started new editgroup <a href="/editgroup/{}">{}</a>'.format(
eg.editgroup_id,
@@ -123,7 +123,7 @@ def generic_entity_edit(editgroup_id, entity_type, existing_ident, edit_template
raise NotImplementedError
except ApiException as ae:
app.log.warning(ae)
- abort(ae.status)
+ raise ae
return redirect('/editgroup/{}/{}/{}'.format(editgroup.editgroup_id, entity_type, edit.ident))
else: # it's an update
# all the tricky logic is in the update method
@@ -151,7 +151,7 @@ def generic_entity_edit(editgroup_id, entity_type, existing_ident, edit_template
if ae.status == 404:
pass
else:
- abort(ae.status)
+ raise ae
try:
if entity_type == 'container':
edit = user_api.update_container(editgroup.editgroup_id, existing.ident, existing)
@@ -163,7 +163,7 @@ def generic_entity_edit(editgroup_id, entity_type, existing_ident, edit_template
raise NotImplementedError
except ApiException as ae:
app.log.warning(ae)
- abort(ae.status)
+ raise ae
return redirect('/editgroup/{}/{}/{}'.format(editgroup.editgroup_id, entity_type, edit.ident))
else:
status = 400
@@ -202,7 +202,7 @@ def generic_edit_delete(editgroup_id, entity_type, edit_id):
try:
editgroup = api.get_editgroup(editgroup_id)
except ApiException as ae:
- abort(ae.status)
+ raise ae
# check that editgroup is edit-able
if editgroup.changelog_index != None:
@@ -223,7 +223,7 @@ def generic_edit_delete(editgroup_id, entity_type, edit_id):
else:
raise NotImplementedError
except ApiException as ae:
- abort(ae.status)
+ raise ae
return redirect("/editgroup/{}".format(editgroup_id))
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index a6634292..02e7b1d3 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -138,7 +138,7 @@ def generic_lookup_view(entity_type, lookup_template, extid_types, lookup_lambda
ae.status)
else:
app.log.info(ae)
- abort(ae.status)
+ raise ae
return redirect('/{}/{}'.format(entity_type, resp.ident))
@app.route('/container/lookup', methods=['GET'])
@@ -512,7 +512,7 @@ def editgroup_create_annotation(ident):
user_api.create_editgroup_annotation(eg.editgroup_id, ega)
except ApiException as ae:
app.log.info(ae)
- abort(ae.status)
+ raise ae
return redirect('/editgroup/{}'.format(ident))
@app.route('/editgroup/<ident>/accept', methods=['POST'])
@@ -770,7 +770,7 @@ def container_issnl_stats(issnl):
try:
container = api.lookup_container(issnl=issnl)
except ApiException as ae:
- abort(ae.status)
+ raise ae
try:
stats = get_elastic_container_stats(container.ident, issnl=container.issnl)
except Exception as ae:
@@ -826,7 +826,7 @@ def release_bibtex(ident):
try:
entity = api.get_release(ident)
except ApiException as ae:
- abort(ae.status)
+ raise ae
csl = release_to_csl(entity)
bibtex = citeproc_csl(csl, 'bibtex')
return Response(bibtex, mimetype="text/plain")
@@ -843,7 +843,7 @@ def release_citeproc(ident):
try:
entity = api.get_release(ident)
except ApiException as ae:
- abort(ae.status)
+ raise ae
csl = release_to_csl(entity)
cite = citeproc_csl(csl, style, is_html)
if is_html:
@@ -901,7 +901,7 @@ def change_username():
editor = user_api.update_editor(editor.editor_id, editor)
except ApiException as ae:
app.log.info(ae)
- abort(ae.status)
+ raise ae
# update our session
session['editor'] = editor.to_dict()
load_user(editor.editor_id)
@@ -938,7 +938,7 @@ def create_auth_token():
duration_seconds=duration_seconds)
except ApiException as ae:
app.log.info(ae)
- abort(ae.status)
+ raise ae
return render_template('auth_token.html', auth_token=resp.token)
@app.route('/auth/logout')