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