Commit da9a6acf authored by Yusei Tahara's avatar Yusei Tahara

log portal_transforms failure.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21145 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 070a369f
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
############################################################################## ##############################################################################
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from zLOG import LOG, WARNING
from Products.ERP5Type.Base import WorkflowMethod from Products.ERP5Type.Base import WorkflowMethod
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator
...@@ -162,10 +163,16 @@ class TextDocument(Document, TextContent): ...@@ -162,10 +163,16 @@ class TextDocument(Document, TextContent):
text_content = self.getTextContent() text_content = self.getTextContent()
if text_content is not None: if text_content is not None:
portal_transforms = getToolByName(self, 'portal_transforms') portal_transforms = getToolByName(self, 'portal_transforms')
return mime_type, portal_transforms.convertTo(mime_type, result = portal_transforms.convertTo(mime_type,
text_content, text_content,
object = self, object=self,
mimetype = src_mimetype) mimetype=src_mimetype)
if result is None:
# portal_transforms fails to convert.
LOG('TextDocument.convert', WARNING,
'portal_transforms failed to convert to text: %r' % self)
result = ''
return mime_type, result
else: else:
# text_content is not set, return empty string instead of None # text_content is not set, return empty string instead of None
return mime_type, '' return mime_type, ''
......
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