eliminate weasy references in code (mostly)
authorJan Szejko <janek37@gmail.com>
Thu, 15 Mar 2018 15:06:46 +0000 (16:06 +0100)
committerJan Szejko <janek37@gmail.com>
Thu, 15 Mar 2018 16:54:14 +0000 (17:54 +0100)
catalogue/models.py
catalogue/publish.py
lib/librarian

index 7d782ad..c73c762 100644 (file)
@@ -239,10 +239,13 @@ class Lesson(models.Model):
             pdf = PdfFormat(wldoc, teacher=True).build()
             self.pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
 
             pdf = PdfFormat(wldoc, teacher=True).build()
             self.pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
 
-    def build_weasy_pdf(self, **kwargs):
-        from .publish import WeasyFormat
+    def build_pdf_from_html(self, **kwargs):
+        from .publish import PdfFromHtmlFormat
         wldoc = self.wldocument()
         wldoc = self.wldocument()
-        pdf = WeasyFormat(wldoc, media_root=settings.MEDIA_ROOT, **kwargs).build()
+        pdf = PdfFromHtmlFormat(
+            wldoc, media_root=settings.MEDIA_ROOT,
+            html_to_pdf_command=settings.HTML_TO_PDF_COMMAND,
+            **kwargs).build()
         self.weasy_pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
 
     def add_to_zip(self, zipf, student=False, prefix=''):
         self.weasy_pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
 
     def add_to_zip(self, zipf, student=False, prefix=''):
index 1fc4ade..293b89e 100755 (executable)
@@ -4,7 +4,7 @@ from django.core.urlresolvers import reverse
 from librarian import DocProvider, IOFile
 from librarian.pyhtml import EduModuleFormat
 from librarian.pypdf import EduModulePDFFormat
 from librarian import DocProvider, IOFile
 from librarian.pyhtml import EduModuleFormat
 from librarian.pypdf import EduModulePDFFormat
-from librarian.weasy import EduModuleWeasyFormat
+from librarian.pdf_from_html import EduModulePdfFromHtmlFormat
 from .models import Lesson, Attachment
 from fnpdjango.utils.text.slughifi import slughifi
 
 from .models import Lesson, Attachment
 from fnpdjango.utils.text.slughifi import slughifi
 
@@ -120,7 +120,7 @@ class PdfFormat(EduModulePDFFormat):
             return src_img
 
 
             return src_img
 
 
-class WeasyFormat(EduModuleWeasyFormat):
+class PdfFromHtmlFormat(EduModulePdfFromHtmlFormat):
     IMAGE_FORMATS = ('PNG', 'JPEG', 'GIF')
     DEFAULT_IMAGE_WIDTH = 1600
 
     IMAGE_FORMATS = ('PNG', 'JPEG', 'GIF')
     DEFAULT_IMAGE_WIDTH = 1600
 
index e4ffa9f..f5c1682 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e4ffa9f5172b88a5a49ed832634105dd65b9727f
+Subproject commit f5c1682d0da0aee458474ef5a9000dd3d62171f4