diff options
Diffstat (limited to 'uploader/background_jobs.py')
| -rw-r--r-- | uploader/background_jobs.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/uploader/background_jobs.py b/uploader/background_jobs.py index d33c498..4aded1d 100644 --- a/uploader/background_jobs.py +++ b/uploader/background_jobs.py @@ -5,7 +5,6 @@ from typing import Callable from functools import partial from flask import ( - url_for, redirect, Response, Blueprint, @@ -16,6 +15,10 @@ 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 background_jobs_bp = Blueprint("background-jobs", __name__) @@ -76,7 +79,8 @@ def handler(job: dict, handler_type: str) -> HandlerType: ).get(handler_type) if bool(_handler): return _handler(job) - return render_template("background-jobs/default-success-page.html", job=job) + return render_template(sui_template("background-jobs/default-success-page.html"), + job=job) error_handler = partial(handler, handler_type="error") @@ -99,10 +103,10 @@ def job_status(job_id: uuid.UUID): if status == "completed": return success_handler(job) - return render_template("jobs/job-status.html", job=job) + return render_template(sui_template("jobs/job-status.html"), job=job) except JobNotFound as _jnf: return render_template( - "jobs/job-not-found.html", + sui_template("jobs/job-not-found.html"), job_id=job_id) @@ -113,6 +117,7 @@ def job_error(job_id: uuid.UUID): with sqlite3.connection(app.config["ASYNCHRONOUS_JOBS_SQLITE_DB"]) as conn: try: job = jobs.job(conn, job_id, fulldetails=True) - return render_template("jobs/job-error.html", job=job) + return render_template(sui_template("jobs/job-error.html"), job=job) except JobNotFound as _jnf: - return render_template("jobs/job-not-found.html", job_id=job_id) + return render_template(sui_template("jobs/job-not-found.html"), + job_id=job_id) |
