Commit 6a0b50bd authored by Jean-Paul Smets's avatar Jean-Paul Smets

Support of portal transforms.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@12221 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c2d13ba8
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Document.Document import Document from Products.ERP5.Document.Document import Document
from Products.ERP5Type.WebDAVSupport import TextContent from Products.ERP5Type.WebDAVSupport import TextContent
...@@ -99,11 +100,12 @@ class TextDocument(Document, TextContent): ...@@ -99,11 +100,12 @@ class TextDocument(Document, TextContent):
if format is None: if format is None:
# The default is to use ERP5 Forms to render the page # The default is to use ERP5 Forms to render the page
return self.view() return self.view()
# For now we just return the raw content # Return the raw content
return self.getTextContent() if format == 'raw':
# XXX - In the future, we will use portal transforms return self.getTextContent()
# to render the content in any format mime_type = getToolByName(self, 'mimetypes_registry').lookupExtension('name.%s' % format)
return self.portal_transforms.convertTo('text/text', self.getTextContent()) return getToolByName(self, 'portal_transforms').convertTo(mime_type,
self.getTextContent(), object=self, mimetype=self.getTextFormat())
### Content indexing methods ### Content indexing methods
security.declareProtected(Permissions.View, 'getSearchableText') security.declareProtected(Permissions.View, 'getSearchableText')
......
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