X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/f8b34544329e05b7c27990ffe9c241df877cd95c..5c7bc1d4380a5c51f13aa274cbea211e4a444a9e:/catalogue/publish.py diff --git a/catalogue/publish.py b/catalogue/publish.py index 023e8bd..bf215a6 100755 --- a/catalogue/publish.py +++ b/catalogue/publish.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 from django.core.files import File +from librarian import DocProvider, IOFile from librarian.pyhtml import EduModuleFormat from .models import Lesson, Attachment @@ -29,7 +30,11 @@ class HtmlFormat(EduModuleFormat): att = lesson.attachment_set.create(slug=slug, ext=fmt) att.file.save(att_name, File(att_file.get_file())) return att.file.url - - else: return att.file.url + + +class OrmDocProvider(DocProvider): + def by_slug(self, slug): + """Should return a file-like object with a WL document XML.""" + return IOFile.from_filename(Lesson.objects.get(slug=slug).xml_file.path)