diff --git a/candidats/pdf.py b/candidats/pdf.py index 7a31d16..3f58198 100644 --- a/candidats/pdf.py +++ b/candidats/pdf.py @@ -1,6 +1,3 @@ -import os -import tempfile - from reportlab.lib.enums import TA_LEFT from reportlab.lib.styles import ParagraphStyle as PS from reportlab.lib.units import cm @@ -25,8 +22,7 @@ class InscriptionSummaryPDF(EpcBaseDocTemplate): """ def __init__(self, candidate, **kwargs): filename = slugify('{0}_{1}'.format(candidate.last_name, candidate.first_name)) + '.pdf' - path = os.path.join(tempfile.gettempdir(), filename) - super().__init__(path, title="Dossier d'inscription", **kwargs) + super().__init__(filename, title="Dossier d'inscription", **kwargs) self.set_normal_template_page() def produce(self, candidate): diff --git a/stages/pdf.py b/stages/pdf.py index efc78fd..143861a 100644 --- a/stages/pdf.py +++ b/stages/pdf.py @@ -149,8 +149,9 @@ class EpcBaseDocTemplate(SimpleDocTemplate): filiere = 'Formation EDE' def __init__(self, filename, title='', pagesize=A4): + path = os.path.join(tempfile.gettempdir(), filename) super().__init__( - filename, pagesize=pagesize, _pageBreakQuick=0, + path, pagesize=pagesize, _pageBreakQuick=0, lefMargin=1.5 * cm, bottomMargin=1.5 * cm, topMargin=1.5 * cm, rightMargin=2.5 * cm ) self.story = [] @@ -373,8 +374,7 @@ class ExpertEDEPDF(EpcBaseDocTemplate): """ def __init__(self, student, **kwargs): filename = slugify('{0}_{1}'.format(student.last_name, student.first_name)) + '.pdf' - path = os.path.join(tempfile.gettempdir(), filename) - super().__init__(path, title="", **kwargs) + super().__init__(filename, title="", **kwargs) self.set_normal_template_page() def produce(self, student):