diff options
Diffstat (limited to 'uploader/background_jobs.py')
| -rw-r--r-- | uploader/background_jobs.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/uploader/background_jobs.py b/uploader/background_jobs.py index a9c0345..fc59ec7 100644 --- a/uploader/background_jobs.py +++ b/uploader/background_jobs.py @@ -16,6 +16,9 @@ from gn_libs import jobs from gn_libs import sqlite3 from gn_libs.jobs.jobs import JobNotFound + +from uploader.sui import sui_template + from uploader.flask_extensions import url_for from uploader.authorisation import require_login @@ -77,8 +80,7 @@ def handler(job: dict, handler_type: str) -> HandlerType: ).get(handler_type) if bool(_handler): return _handler(job) - _sui = "sui-" if request.args.get("streamlined_ui") else "" - return render_template(f"background-jobs/{_sui}default-success-page.html", + return render_template(sui_template("background-jobs/default-success-page.html"), job=job) @@ -90,7 +92,6 @@ success_handler = partial(handler, handler_type="success") @require_login def job_status(job_id: uuid.UUID): """View the job status.""" - _sui = "sui-" if request.args.get("streamlined_ui") else "" with sqlite3.connection(app.config["ASYNCHRONOUS_JOBS_SQLITE_DB"]) as conn: try: job = jobs.job(conn, job_id, fulldetails=True) @@ -103,10 +104,10 @@ def job_status(job_id: uuid.UUID): if status == "completed": return success_handler(job) - return render_template(f"jobs/{_sui}job-status.html", job=job) + return render_template(sui_template("jobs/job-status.html"), job=job) except JobNotFound as _jnf: return render_template( - f"jobs/{_sui}job-not-found.html", + sui_template("jobs/job-not-found.html"), job_id=job_id) @@ -114,10 +115,10 @@ def job_status(job_id: uuid.UUID): @require_login def job_error(job_id: uuid.UUID): """Handle job errors in a generic manner.""" - _sui = "sui-" if request.args.get("streamlined_ui") else "" with sqlite3.connection(app.config["ASYNCHRONOUS_JOBS_SQLITE_DB"]) as conn: try: job = jobs.job(conn, job_id, fulldetails=True) - return render_template(f"jobs/{_sui}job-error.html", job=job) + return render_template(sui_template("jobs/job-error.html"), job=job) except JobNotFound as _jnf: - return render_template(f"jobs/{_sui}job-not-found.html", job_id=job_id) + return render_template(sui_template("jobs/job-not-found.html"), + job_id=job_id) |
