[Erp5-report] r35243 nicolas - /erp5/trunk/products/ERP5/Document/File.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed May 12 18:27:40 CEST 2010
Author: nicolas
Date: Wed May 12 18:27:34 2010
New Revision: 35243
URL: http://svn.erp5.org?rev=35243&view=rev
Log:
* Try to read content_type from property it self first.
* no need to call getTextFormat, this property hsa been removed
Modified:
erp5/trunk/products/ERP5/Document/File.py
Modified: erp5/trunk/products/ERP5/Document/File.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/File.py?rev=35243&r1=35242&r2=35243&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/File.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/File.py [utf8] Wed May 12 18:27:34 2010
@@ -198,26 +198,18 @@
"""This method returns a tuple which contains mimetype and content."""
from Products.ERP5.Document.EmailDocument import MimeTypeException
# return a tuple (mime_type, data)
- mime_type = None
content = None
-
- # WARNING - this could fail since getContentType
- # is not (yet) part of Document API
- if getattr(self, 'getContentType', None) is not None:
- mime_type = self.getContentType()
- elif getattr(self, 'getTextFormat', None) is not None:
- mime_type = self.getTextFormat()
- else:
- raise ValueError, "Cannot find mimetype of the document."
-
- if mime_type is not None:
- try:
- mime_type, content = self.convert(mime_type)
- except ConversionError:
- mime_type = self.getBaseContentType()
- content = self.getBaseData()
- except (NotImplementedError, MimeTypeException):
- pass
+ mime_type = self.getContentType()
+
+ if mime_type is None:
+ raise ValueError('Cannot find mimetype of the document.')
+ try:
+ mime_type, content = self.convert(None)
+ except ConversionError:
+ mime_type = self.getBaseContentType()
+ content = self.getBaseData()
+ except (NotImplementedError, MimeTypeException):
+ pass
if content is None:
if getattr(self, 'getTextContent', None) is not None:
More information about the Erp5-report
mailing list