From: Jan Szejko Date: Thu, 15 Mar 2018 15:06:46 +0000 (+0100) Subject: eliminate weasy references in code (mostly) X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/26c45c9115e985280c9c0d8f6560ebce0c133242 eliminate weasy references in code (mostly) --- diff --git a/catalogue/models.py b/catalogue/models.py index 7d782ad..c73c762 100644 --- a/catalogue/models.py +++ b/catalogue/models.py @@ -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()))) - def build_weasy_pdf(self, **kwargs): - from .publish import WeasyFormat + def build_pdf_from_html(self, **kwargs): + from .publish import PdfFromHtmlFormat 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=''): diff --git a/catalogue/publish.py b/catalogue/publish.py index 1fc4ade..293b89e 100755 --- a/catalogue/publish.py +++ b/catalogue/publish.py @@ -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.weasy import EduModuleWeasyFormat +from librarian.pdf_from_html import EduModulePdfFromHtmlFormat from .models import Lesson, Attachment from fnpdjango.utils.text.slughifi import slughifi @@ -120,7 +120,7 @@ class PdfFormat(EduModulePDFFormat): return src_img -class WeasyFormat(EduModuleWeasyFormat): +class PdfFromHtmlFormat(EduModulePdfFromHtmlFormat): IMAGE_FORMATS = ('PNG', 'JPEG', 'GIF') DEFAULT_IMAGE_WIDTH = 1600 diff --git a/lib/librarian b/lib/librarian index e4ffa9f..f5c1682 160000 --- a/lib/librarian +++ b/lib/librarian @@ -1 +1 @@ -Subproject commit e4ffa9f5172b88a5a49ed832634105dd65b9727f +Subproject commit f5c1682d0da0aee458474ef5a9000dd3d62171f4