|
3 | 3 | from AccessControl import getSecurityManager |
4 | 4 | from collective.classification.folder.interfaces import IServiceInCharge |
5 | 5 | from collective.classification.folder.interfaces import IServiceInCopy |
| 6 | +from collective.collabora.interfaces import IStoredFile |
6 | 7 | from collective.contact.core.content.held_position import IHeldPosition |
7 | 8 | from collective.contact.core.content.organization import IOrganization |
8 | 9 | from collective.contact.core.indexers import contact_source |
|
15 | 16 | from collective.dms.basecontent.dmsfile import IDmsFile |
16 | 17 | from collective.dms.mailcontent.indexers import add_parent_organizations |
17 | 18 | from collective.dms.scanbehavior.behaviors.behaviors import IScanFields |
| 19 | +from collective.documentgenerator.content.pod_template import IPODTemplate |
18 | 20 | from collective.task.interfaces import ITaskContent |
19 | 21 | from imio.dms.mail import BACK_OR_AGAIN_ICONS |
20 | 22 | from imio.dms.mail import IM_READER_SERVICE_FUNCTIONS |
|
41 | 43 | from plone.app.contentmenu.menu import WorkflowMenu as OrigWorkflowMenu |
42 | 44 | from plone.app.contenttypes.indexers import _unicode_save_string_concat |
43 | 45 | from plone.indexer import indexer |
| 46 | +from plone.namedfile.file import NamedBlobFile |
44 | 47 | from plone.registry.interfaces import IRegistry |
45 | 48 | from plone.rfc822.interfaces import IPrimaryFieldInfo |
46 | 49 | from Products.ATContentTypes.interfaces.folder import IATFolder |
@@ -1043,3 +1046,30 @@ def get(self): |
1043 | 1046 | "title": child.title, |
1044 | 1047 | "UID": child.UID(), |
1045 | 1048 | } |
| 1049 | + |
| 1050 | + |
| 1051 | +@adapter(IPODTemplate) |
| 1052 | +@implementer(IStoredFile) |
| 1053 | +class StoredPodTemplate(object): |
| 1054 | + """Access the file storage on a PODTemplate content object. |
| 1055 | +
|
| 1056 | + i.e. the file attribute on the content object. |
| 1057 | + """ |
| 1058 | + |
| 1059 | + def __init__(self, context): |
| 1060 | + self.context = context |
| 1061 | + self.filename = context.odt_file.filename |
| 1062 | + self.contentType = context.odt_file.contentType |
| 1063 | + |
| 1064 | + @property |
| 1065 | + def data(self): |
| 1066 | + return self.context.odt_file.data |
| 1067 | + |
| 1068 | + @data.setter |
| 1069 | + def data(self, data): |
| 1070 | + self.context.odt_file = NamedBlobFile( |
| 1071 | + data=data, filename=self.filename, contentType=self.contentType |
| 1072 | + ) |
| 1073 | + |
| 1074 | + def getSize(self): |
| 1075 | + return self.context.odt_file.getSize() |
0 commit comments