Commit db07ba2d authored by Nicolas Dumazet's avatar Nicolas Dumazet

if data is an OFSImage, data.data should be a Pdata object, and

should be hashed using hashPdataObject instead of md5.new(data.data)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35292 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e5cb0d8e
......@@ -121,6 +121,11 @@ class CachedConvertableMixin:
"""
"""
cache_id = self._getCacheKey(**kw)
if isinstance(data, OFSImage):
# data.data should be a Pdata object
data = data.data
if data is None:
cached_value = None
conversion_md5 = None
......@@ -129,14 +134,11 @@ class CachedConvertableMixin:
cached_value = aq_base(data)
conversion_md5 = hashPdataObject(cached_value)
size = len(cached_value)
elif isinstance(data, OFSImage):
cached_value = data
conversion_md5 = md5.new(str(data.data)).hexdigest()
size = len(data.data)
else:
cached_value = data
conversion_md5 = md5.new(cached_value).hexdigest()
size = len(cached_value)
if date is None:
date = DateTime()
stored_data_dict = {'content_md5': self.getContentMd5(),
......
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