[Erp5-report] r12221 - /erp5/trunk/products/ERP5/Document/TextDocument.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Jan 23 11:36:19 CET 2007


Author: jp
Date: Tue Jan 23 11:36:16 2007
New Revision: 12221

URL: http://svn.erp5.org?rev=12221&view=rev
Log:
Support of portal transforms.

Modified:
    erp5/trunk/products/ERP5/Document/TextDocument.py

Modified: erp5/trunk/products/ERP5/Document/TextDocument.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TextDocument.py?rev=12221&r1=12220&r2=12221&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TextDocument.py (original)
+++ erp5/trunk/products/ERP5/Document/TextDocument.py Tue Jan 23 11:36:16 2007
@@ -28,6 +28,7 @@
 
 from AccessControl import ClassSecurityInfo
 
+from Products.CMFCore.utils import getToolByName
 from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
 from Products.ERP5.Document.Document import Document
 from Products.ERP5Type.WebDAVSupport import TextContent
@@ -99,11 +100,12 @@
       if format is None:
         # The default is to use ERP5 Forms to render the page
         return self.view()
-      # For now we just return the raw content
-      return self.getTextContent()
-      # XXX - In the future, we will use portal transforms
-      # to render the content in any format
-      return self.portal_transforms.convertTo('text/text', self.getTextContent())
+      # Return the raw content
+      if format == 'raw':
+        return self.getTextContent()
+      mime_type = getToolByName(self, 'mimetypes_registry').lookupExtension('name.%s' % format)
+      return getToolByName(self, 'portal_transforms').convertTo(mime_type,
+                           self.getTextContent(), object=self, mimetype=self.getTextFormat())
 
     ### Content indexing methods
     security.declareProtected(Permissions.View, 'getSearchableText')




More information about the Erp5-report mailing list