[Erp5-report] r35236 nicolas - /erp5/trunk/products/ERP5/Document/Image.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed May 12 17:30:00 CEST 2010
Author: nicolas
Date: Wed May 12 17:29:55 2010
New Revision: 35236
URL: http://svn.erp5.org?rev=35236&view=rev
Log:
The purpose of getContentType is not to guess any content_type
from string format
Modified:
erp5/trunk/products/ERP5/Document/Image.py
Modified: erp5/trunk/products/ERP5/Document/Image.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Image.py?rev=35236&r1=35235&r2=35236&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Image.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/Image.py [utf8] Wed May 12 17:29:55 2010
@@ -46,10 +46,6 @@
VALID_TEXT_FORMAT_LIST
from OFS.Image import Image as OFSImage
from OFS.Image import getImageInfo
-try:
- from OFS.content_types import guess_content_type
-except ImportError:
- from zope.contenttype import guess_content_type
from zLOG import LOG, WARNING
# import mixin
@@ -63,6 +59,7 @@
DEFAULT_QUALITY = 75
+_MARKER = []
class Image(TextConvertableMixin, File, OFSImage):
"""
An Image is a File which contains image data. It supports
@@ -176,14 +173,15 @@
return self.height
security.declareProtected(Permissions.AccessContentsInformation, 'getContentType')
- def getContentType(self, format=''):
+ def getContentType(self, default=_MARKER):
"""Original photo content_type."""
self._upradeImage()
- if self.get_size() and not self._baseGetContentType(): self._update_image_info()
- if format == '':
+ if self.hasData() and not self.hasContentType():
+ self._update_image_info()
+ if default is _MARKER:
return self._baseGetContentType()
else:
- return guess_content_type('myfile.' + format)[0]
+ return self._baseGetContentType(default)
#
# Photo display methods
More information about the Erp5-report
mailing list