diff options
Diffstat (limited to 'qc_app/entry.py')
-rw-r--r-- | qc_app/entry.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/qc_app/entry.py b/qc_app/entry.py index bf78037..0cd34c5 100644 --- a/qc_app/entry.py +++ b/qc_app/entry.py @@ -14,7 +14,8 @@ from flask import ( render_template, current_app as app) -from .dbinsert import species +from qc_app.db import species +from qc_app.db_utils import with_db_connection entrybp = Blueprint("entry", __name__) @@ -78,14 +79,16 @@ def zip_file_errors(filepath, upload_dir) -> Tuple[str, ...]: def upload_file(): """Enables uploading the files""" if request.method == "GET": - return render_template("index.html", species = species()) + return render_template( + "index.html", species=with_db_connection(species)) upload_dir = app.config["UPLOAD_FOLDER"] request_errors = errors(request) if request_errors: for error in request_errors: flash(error, "alert-error") - return render_template("index.html", species = species()), 400 + return render_template( + "index.html", species=with_db_connection(species)), 400 filename = secure_filename(request.files["qc_text_file"].filename) if not os.path.exists(upload_dir): @@ -98,7 +101,8 @@ def upload_file(): if zip_errors: for error in zip_errors: flash(error, "alert-error") - return render_template("index.html", species = species()), 400 + return render_template( + "index.html", species=with_db_connection(species)), 400 return redirect(url_for( "parse.parse", filename=filename, |