from django.db.models.fields.files import FieldFile
from catalogue import app_settings
from catalogue.constants import LANGUAGES_3TO2
-from catalogue.utils import remove_zip, truncate_html_words, gallery_path
+from catalogue.utils import remove_zip, truncate_html_words, gallery_path, gallery_url
from celery.task import Task, task
from celery.utils.log import get_task_logger
from waiter.utils import clear_cache
book = fieldfile.instance
- html_output = self.transform(
- book.wldocument(parse_dublincore=False),
- fieldfile)
+ html_output = self.transform(book.wldocument(), fieldfile)
# Delete old fragments, create from scratch if necessary.
book.fragments.all().delete()
return True
return False
+ @staticmethod
+ def transform(wldoc, fieldfile):
+ return wldoc.as_html(options={'gallery': "'%s'" % gallery_url(wldoc.book_info.url.slug)})
+
@BuildEbook.register('cover_thumb')
@task(ignore_result=True)
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
-import urllib
-import os.path
-
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ValidationError
from catalogue.utils import get_customized_pdf_path
from catalogue.tasks import build_custom_pdf
-from wolnelektury.utils import makedirs
class BookImportForm(forms.Form):