mirror of
				https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
				synced 2025-11-04 12:22:47 +00:00 
			
		
		
		
	Use pathlib where possible
This commit is contained in:
		@@ -1,7 +1,6 @@
 | 
			
		||||
from flask import abort, current_app
 | 
			
		||||
from flask_login import current_user
 | 
			
		||||
from threading import Thread
 | 
			
		||||
import os
 | 
			
		||||
from app import db
 | 
			
		||||
from app.decorators import admin_required, content_negotiation
 | 
			
		||||
from app.models import Job, JobStatus
 | 
			
		||||
@@ -39,7 +38,7 @@ def job_log(job_id):
 | 
			
		||||
    if job.status not in [JobStatus.COMPLETED, JobStatus.FAILED]:
 | 
			
		||||
        response = {'errors': {'message': 'Job status is not completed or failed'}}
 | 
			
		||||
        return response, 409
 | 
			
		||||
    with open(os.path.join(job.path, 'pipeline_data', 'logs', 'pyflow_log.txt')) as log_file:
 | 
			
		||||
    with open(job.path / 'pipeline_data' / 'logs' / 'pyflow_log.txt') as log_file:
 | 
			
		||||
        log = log_file.read()
 | 
			
		||||
    response_data = {
 | 
			
		||||
        'jobLog': log
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,6 @@ from flask import (
 | 
			
		||||
)
 | 
			
		||||
from flask_breadcrumbs import register_breadcrumb
 | 
			
		||||
from flask_login import current_user
 | 
			
		||||
import os
 | 
			
		||||
from app.models import Job, JobInput, JobResult
 | 
			
		||||
from . import bp
 | 
			
		||||
from .utils import job_dynamic_list_constructor as job_dlc
 | 
			
		||||
@@ -38,8 +37,8 @@ def download_job_input(job_id, job_input_id):
 | 
			
		||||
    if not (job_input.job.user == current_user or current_user.is_administrator()):
 | 
			
		||||
        abort(403)
 | 
			
		||||
    return send_from_directory(
 | 
			
		||||
        os.path.dirname(job_input.path),
 | 
			
		||||
        os.path.basename(job_input.path),
 | 
			
		||||
        job_input.path.parent,
 | 
			
		||||
        job_input.path.name,
 | 
			
		||||
        as_attachment=True,
 | 
			
		||||
        attachment_filename=job_input.filename,
 | 
			
		||||
        mimetype=job_input.mimetype
 | 
			
		||||
@@ -52,8 +51,8 @@ def download_job_result(job_id, job_result_id):
 | 
			
		||||
    if not (job_result.job.user == current_user or current_user.is_administrator()):
 | 
			
		||||
        abort(403)
 | 
			
		||||
    return send_from_directory(
 | 
			
		||||
        os.path.dirname(job_result.path),
 | 
			
		||||
        os.path.basename(job_result.path),
 | 
			
		||||
        job_result.path.parent,
 | 
			
		||||
        job_result.path.name,
 | 
			
		||||
        as_attachment=True,
 | 
			
		||||
        attachment_filename=job_result.filename,
 | 
			
		||||
        mimetype=job_result.mimetype
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user