fnp
/
edumed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
data() considered harmful
[edumed.git]
/
catalogue
/
publish.py
diff --git
a/catalogue/publish.py
b/catalogue/publish.py
index
023e8bd
..
bf215a6
100755
(executable)
--- a/
catalogue/publish.py
+++ b/
catalogue/publish.py
@@
-1,5
+1,6
@@
# -*- coding: utf-8
from django.core.files import File
# -*- coding: utf-8
from django.core.files import File
+from librarian import DocProvider, IOFile
from librarian.pyhtml import EduModuleFormat
from .models import Lesson, Attachment
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
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
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)