+ def build_pdf(self, student=False, infile=None):
+ from librarian.parser import WLDocument
+ from .publish import PdfFormat, OrmDocProvider
+
+ if infile is None:
+ wldoc = WLDocument.from_file(self.xml_file.path, provider=OrmDocProvider)
+ else:
+ wldoc = WLDocument(infile, provider=OrmDocProvider())
+ pdf = PdfFormat(wldoc).build()
+ if student:
+ self.student_pdf.save("%s.pdf" % self.slug,
+ File(open(pdf.get_filename())))
+ else:
+ self.pdf.save("%s.pdf" % self.slug,
+ File(open(pdf.get_filename())))
+