[Erp5-report] r35381 nicolas - /erp5/trunk/products/ERP5/mixin/cached_convertable.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon May 17 13:43:16 CEST 2010


Author: nicolas
Date: Mon May 17 13:43:12 2010
New Revision: 35381

URL: http://svn.erp5.org?rev=35381&view=rev
Log:
revert r35292
The cached value need to be the image itself, not only image content.
The work around md5 hashing calculation is still on going


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=35381&r1=35380&r2=35381&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] (original)
+++ erp5/trunk/products/ERP5/mixin/cached_convertable.py [utf8] Mon May 17 13:43:12 2010
@@ -128,11 +128,6 @@
     """
     """
     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
@@ -141,11 +136,14 @@
       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