Commit 5586b333 authored by Nicolas Delaby's avatar Nicolas Delaby

* Try to read content_type from property it self first.

* no need to call getTextFormat, this property hsa been removed



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35243 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 99d9517a
...@@ -198,26 +198,18 @@ class File(Document, CMFFile): ...@@ -198,26 +198,18 @@ class File(Document, CMFFile):
"""This method returns a tuple which contains mimetype and content.""" """This method returns a tuple which contains mimetype and content."""
from Products.ERP5.Document.EmailDocument import MimeTypeException from Products.ERP5.Document.EmailDocument import MimeTypeException
# return a tuple (mime_type, data) # return a tuple (mime_type, data)
mime_type = None
content = None content = None
mime_type = self.getContentType()
# WARNING - this could fail since getContentType
# is not (yet) part of Document API if mime_type is None:
if getattr(self, 'getContentType', None) is not None: raise ValueError('Cannot find mimetype of the document.')
mime_type = self.getContentType() try:
elif getattr(self, 'getTextFormat', None) is not None: mime_type, content = self.convert(None)
mime_type = self.getTextFormat() except ConversionError:
else: mime_type = self.getBaseContentType()
raise ValueError, "Cannot find mimetype of the document." content = self.getBaseData()
except (NotImplementedError, MimeTypeException):
if mime_type is not None: pass
try:
mime_type, content = self.convert(mime_type)
except ConversionError:
mime_type = self.getBaseContentType()
content = self.getBaseData()
except (NotImplementedError, MimeTypeException):
pass
if content is None: if content is None:
if getattr(self, 'getTextContent', None) is not None: if getattr(self, 'getTextContent', None) is not None:
......
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