From a00d3bd9a2cbd11e8e86359432d3410332755f09 Mon Sep 17 00:00:00 2001
From: Fabien Morin <fabien@nexedi.com>
Date: Wed, 30 Dec 2009 10:22:01 +0000
Subject: [PATCH] store cache data in the same way for all Image.py methods

Image were not stored in the same way in every methods :
in case of index_html, the image was stored, in case of convert, the image.data
was stored.
This lead to conflicts because in both cases, the cache_id was the same, so if
inded_html was first call, and after that, convert was call on the same image,
convert will return an Image object instead of image.data String.

Now in all cases, the image is stored by setConversion, and in case of convert,
only image.data is returned.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31532 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/Image.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/Document/Image.py b/product/ERP5/Document/Image.py
index fce1bf15a8..d95cc33868 100644
--- a/product/ERP5/Document/Image.py
+++ b/product/ERP5/Document/Image.py
@@ -344,10 +344,11 @@ class Image(File, OFSImage):
       kw = dict(display=display, format=format, quality=quality,
                 resolution=resolution, frame=frame, image_size=image_size)
       try:
-        return self.getConversion(**kw)
+        mime, image = self.getConversion(**kw)
+        return mime, image.data
       except KeyError:
         mime, image = self._makeDisplayPhoto(**kw)
-        self.setConversion(image.data, mime, **kw)
+        self.setConversion(image, mime, **kw)
         return mime, image.data
     return self.getContentType(), self.getData()
 
-- 
2.30.9