Commit a00d3bd9 authored by Fabien Morin's avatar Fabien Morin

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
parent f2c35313
...@@ -344,10 +344,11 @@ class Image(File, OFSImage): ...@@ -344,10 +344,11 @@ class Image(File, OFSImage):
kw = dict(display=display, format=format, quality=quality, kw = dict(display=display, format=format, quality=quality,
resolution=resolution, frame=frame, image_size=image_size) resolution=resolution, frame=frame, image_size=image_size)
try: try:
return self.getConversion(**kw) mime, image = self.getConversion(**kw)
return mime, image.data
except KeyError: except KeyError:
mime, image = self._makeDisplayPhoto(**kw) mime, image = self._makeDisplayPhoto(**kw)
self.setConversion(image.data, mime, **kw) self.setConversion(image, mime, **kw)
return mime, image.data return mime, image.data
return self.getContentType(), self.getData() return self.getContentType(), self.getData()
......
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