Commit ed296aa4 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added support for data stored on _data property.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@14388 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4328154a
......@@ -125,6 +125,7 @@ class Image(File, OFSImage):
self.size = len(self.data)
self._setContentType(content_type)
def _upradeImage(self):
"""
This method upgrades internal data structures is required
......@@ -140,6 +141,10 @@ class Image(File, OFSImage):
self.height = self._original.height
self.width = self._original.width
# Make sure old Image objects can still be accessed
if not hasattr(aq_base(self), 'data') and hasattr(aq_base(self), '_data'):
self.data = self._data
# Make sure size is defined
if not hasattr(aq_base(self), 'size') or not self.size:
self.size = len(self.data)
......@@ -166,6 +171,7 @@ class Image(File, OFSImage):
def getContentType(self, format=''):
"""Original photo content_type."""
self._upradeImage()
if self.get_size() and not self._baseGetContentType(): self._update_image_info()
if format == '':
return self._baseGetContentType()
else:
......
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