aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/routes.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_web/routes.py')
-rw-r--r--python/fatcat_web/routes.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/python/fatcat_web/routes.py b/python/fatcat_web/routes.py
index 02b5258a..7cf1f854 100644
--- a/python/fatcat_web/routes.py
+++ b/python/fatcat_web/routes.py
@@ -3,7 +3,7 @@ import os
import json
import citeproc_styles
from flask import render_template, make_response, send_from_directory, \
- request, url_for, abort, redirect, jsonify, session, flash, Response
+ request, url_for, abort, redirect, jsonify, session, Response
from flask_login import login_required
from flask_wtf.csrf import CSRFError
@@ -685,7 +685,7 @@ def generic_search():
if len(query.split()) != 1:
# multi-term? must be a real search
- return redirect(url_for('release_search', q=query))
+ return redirect(url_for('release_search', q=query, generic=1))
if clean_doi(query):
return redirect(url_for('release_lookup', doi=clean_doi(query)))
@@ -704,7 +704,7 @@ def generic_search():
if clean_orcid(query):
return redirect(url_for('creator_lookup', orcid=clean_orcid(query)))
- return redirect(url_for('release_search', q=query))
+ return redirect(url_for('release_search', q=query, generic=1))
@app.route('/release/search', methods=['GET', 'POST'])
def release_search():
@@ -712,12 +712,21 @@ def release_search():
if 'q' not in request.args.keys():
return render_template('release_search.html', query=ReleaseQuery(), found=None)
+ container_found = None
+ if request.args.get('generic'):
+ container_query = GenericQuery.from_args(request.args)
+ container_query.limit = 1
+ try:
+ container_found = do_container_search(container_query)
+ except Exception:
+ pass
+
query = ReleaseQuery.from_args(request.args)
try:
found = do_release_search(query)
except FatcatSearchError as fse:
return render_template('release_search.html', query=query, es_error=fse), fse.status_code
- return render_template('release_search.html', query=query, found=found)
+ return render_template('release_search.html', query=query, found=found, container_found=container_found)
@app.route('/container/search', methods=['GET', 'POST'])
def container_search():
@@ -986,7 +995,7 @@ def health_json():
def login():
# show the user a list of login options
if not priv_api:
- flash("This web interface not configured with credentials to actually allow login (other than via token)")
+ app.log.warn("This web interface not configured with credentials to actually allow login (other than via token)")
return render_template('auth_login.html')
@app.route('/auth/ia/login', methods=['GET', 'POST'])
@@ -1026,7 +1035,6 @@ def change_username():
# update our session
session['editor'] = editor.to_dict()
load_user(editor.editor_id)
- flash("Username updated successfully")
return redirect('/auth/account')
@app.route('/auth/create_token', methods=['POST'])