Commit 086d18cf authored by Julien Muchembled's avatar Julien Muchembled

Do not repeat the same list of parameters all the time

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29450 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 39f9edc3
......@@ -204,18 +204,14 @@ class Image(File, OFSImage):
image_size = self.getSizeFromImageDisplay(display)
if (display is not None or resolution is not None or quality!=75 or format != ''\
or frame is not None) and image_size:
kw = dict(display=display, format=format, quality=quality,
resolution=resolution, frame=frame, image_size=image_size)
try:
mime, image = self.getConversion(display=display, format=format,
quality=quality, resolution=resolution,
frame=frame, image_size=image_size)
mime, image = self.getConversion(**kw)
except KeyError:
# Generate photo on-the-fly
mime, image = self._makeDisplayPhoto(display, format=format, quality=quality,
resolution=resolution, frame=frame,
image_size=image_size)
self.setConversion(image, mime, display=display, format=format,
quality=quality, resolution=resolution,
frame=frame, image_size=image_size)
mime, image = self._makeDisplayPhoto(**kw)
self.setConversion(image, mime, **kw)
width, height = (image.width, image.height)
# Set cookie for chosen size
if cookie:
......@@ -373,25 +369,20 @@ class Image(File, OFSImage):
"""Return the image data."""
self._upradeImage()
_setCacheHeaders(_ViewEmulator().__of__(self), dict(display=display,
format=format, quality=quality, resolution=resolution, frame=frame))
# display may be set from a cookie (?)
image_size = self.getSizeFromImageDisplay(display)
kw = dict(display=display, format=format, quality=quality,
resolution=resolution, frame=frame, image_size=image_size)
_setCacheHeaders(_ViewEmulator().__of__(self), kw)
if (display is not None or resolution is not None or quality != 75 or format != ''\
or frame is not None) and image_size:
try:
mime, image = self.getConversion(display=display, format=format,
quality=quality, resolution=resolution,
frame=frame, image_size=image_size)
mime, image = self.getConversion(**kw)
except KeyError:
# Generate photo on-the-fly
mime, image = self._makeDisplayPhoto(display, format=format, quality=quality,
resolution=resolution, frame=frame,
image_size=image_size)
self.setConversion(image, mime, display=display, format=format, quality=quality,
resolution=resolution, frame=frame,
image_size=image_size)
mime, image = self._makeDisplayPhoto(**kw)
self.setConversion(image, mime, **kw)
RESPONSE.setHeader('Content-Type', mime)
return image.index_html(REQUEST, RESPONSE)
......
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