Commit d216762e authored by Nicolas Delaby's avatar Nicolas Delaby

It's faster to call getToolByName on portal itself.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@33795 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fe7535e5
...@@ -211,7 +211,8 @@ class TextDocument(Document, TextContent): ...@@ -211,7 +211,8 @@ class TextDocument(Document, TextContent):
# Return the raw content # Return the raw content
if format == 'raw': if format == 'raw':
return 'text/plain', self.getTextContent() return 'text/plain', self.getTextContent()
mime_type = getToolByName(self, 'mimetypes_registry').lookupExtension('name.%s' % format) portal = self.getPortalObject()
mime_type = getToolByName(portal, 'mimetypes_registry').lookupExtension('name.%s' % format)
mime_type = str(mime_type) mime_type = str(mime_type)
src_mimetype = self.getTextFormat(DEFAULT_TEXT_FORMAT) src_mimetype = self.getTextFormat(DEFAULT_TEXT_FORMAT)
if not src_mimetype.startswith('text/'): if not src_mimetype.startswith('text/'):
...@@ -220,7 +221,7 @@ class TextDocument(Document, TextContent): ...@@ -220,7 +221,7 @@ class TextDocument(Document, TextContent):
text_content = self.getTextContent() text_content = self.getTextContent()
if text_content: if text_content:
if not self.hasConversion(format=format): if not self.hasConversion(format=format):
portal_transforms = getToolByName(self, 'portal_transforms') portal_transforms = getToolByName(portal, 'portal_transforms')
filename = self.getSourceReference(self.getTitleOrId()) filename = self.getSourceReference(self.getTitleOrId())
result = portal_transforms.convertToData(mime_type, text_content, result = portal_transforms.convertToData(mime_type, text_content,
object=self, context=self, object=self, context=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