[Erp5-report] r35292 nicolas.dumazet - /erp5/trunk/products/ERP5/mixin/cached_convertable.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu May 13 04:17:44 CEST 2010
Author: nicolas.dumazet
Date: Thu May 13 04:17:44 2010
New Revision: 35292
URL: http://svn.erp5.org?rev=35292&view=rev
Log:
if data is an OFSImage, data.data should be a Pdata object, and
should be hashed using hashPdataObject instead of md5.new(data.data)
Modified:
erp5/trunk/products/ERP5/mixin/cached_convertable.py
Modified: erp5/trunk/products/ERP5/mixin/cached_convertable.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/mixin/cached_convertable.py?rev=35292&r1=35291&r2=35292&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] Thu May 13 04:17:44 2010
@@ -121,6 +121,11 @@
"""
"""
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 @@
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(),
More information about the Erp5-report
mailing list