Commit 987d2eb8 authored by Adrià Labay's avatar Adrià Labay
Browse files

create exam dir when an unstructured exam is added

parent 0dc1fba4
import hashlib
from io import BytesIO
import os
from flask import current_app, send_file, stream_with_context, Response
from flask_restful import Resource, reqparse
......@@ -10,7 +11,7 @@ from sqlalchemy import func
from zesje.api._helpers import _shuffle, abort
from zesje.api.problems import problem_to_data
from ..pdf_generation import exam_pdf_path, _exam_generate_data
from ..pdf_generation import exam_dir, exam_pdf_path, _exam_generate_data
from ..pdf_generation import generate_pdfs, generate_single_pdf, generate_zipped_pdfs
from ..pdf_generation import page_is_size, save_with_even_pages
from ..pdf_generation import write_finalized_exam
......@@ -296,6 +297,8 @@ class Exams(Resource):
exam.token = generate_exam_token(exam.id, exam_name, None)
db.session.commit()
os.makedirs(exam_dir(exam.id), exist_ok=True)
return exam
put_parser = reqparse.RequestParser()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment