Commit 51f69cf1 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Better support for conversion.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13481 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ac7350b5
......@@ -133,8 +133,11 @@ class TextDocument(Document, TextContent):
if format == 'raw':
return self.getTextContent()
mime_type = getToolByName(self, 'mimetypes_registry').lookupExtension('name.%s' % format)
src_mimetype = self.getTextFormat()
if not src_mimetype.startswith('text/'):
src_mimetype = 'text/%s' % src_mimetype
return getToolByName(self, 'portal_transforms').convertTo(mime_type,
self.getTextContent(), object=self, mimetype=self.getTextFormat())
self.getTextContent(), object=self, mimetype=src_mimetype)
def __call__(self):
_setCacheHeaders(self, {})
......
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