Commit a1768d91 authored by Nicolas Delaby's avatar Nicolas Delaby

Add support of cache

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38314 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8b4f905b
...@@ -299,17 +299,24 @@ class File(Document, CMFFile): ...@@ -299,17 +299,24 @@ class File(Document, CMFFile):
elif content_type in portal.portal_transforms._mtmap: elif content_type in portal.portal_transforms._mtmap:
# Look if portal_transforms can handle the content_type # Look if portal_transforms can handle the content_type
# of this File # of this File
mime_type = getToolByName(portal, 'mimetypes_registry').\ kw['format'] = format
lookupExtension('name.%s' % format) if not self.hasConversion(**kw):
result = portal.portal_transforms.convertToData(mime_type, self.getData(), mime_type = str(getToolByName(portal, 'mimetypes_registry').\
object=self, context=self, lookupExtension('name.%s' % format))
result = portal.portal_transforms.convertToData(mime_type,
self.getData(),
object=self,
context=self,
mimetype=content_type) mimetype=content_type)
if not result: if not result:
raise ConversionError('File conversion error. ' raise ConversionError('File conversion error. '
'portal_transforms failed to convert '\ 'portal_transforms failed to convert '\
'from %s to %s; %r' % (content_type, mime_type, 'from %s to %s; %r' % (content_type, mime_type,
self)) self))
return str(mime_type), result self.setConversion(result, mime_type, **kw)
else:
mime_type, result = self.getConversion(**kw)
return mime_type, result
else: else:
# We didn't find suitable wrapper to convert this File # We didn't find suitable wrapper to convert this File
if format in VALID_TEXT_FORMAT_LIST: if format in VALID_TEXT_FORMAT_LIST:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment