Commit 58d7b330 authored by Ivan Tyagov's avatar Ivan Tyagov

Use _MARKER instead of None to allow explicitly quality to be determined by...

Use _MARKER instead of None to allow explicitly quality to be determined by background convet application (if required).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37214 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e6031c95
...@@ -185,7 +185,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -185,7 +185,7 @@ class Image(TextConvertableMixin, File, OFSImage):
security.declareProtected(Permissions.View, 'tag') security.declareProtected(Permissions.View, 'tag')
def tag(self, display=None, height=None, width=None, cookie=0, def tag(self, display=None, height=None, width=None, cookie=0,
alt=None, css_class=None, format=None, quality=None, alt=None, css_class=None, format=None, quality=_MARKER,
resolution=None, frame=None, **kw): resolution=None, frame=None, **kw):
"""Return HTML img tag.""" """Return HTML img tag."""
self._upradeImage() self._upradeImage()
...@@ -193,7 +193,7 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -193,7 +193,7 @@ class Image(TextConvertableMixin, File, OFSImage):
# Get cookie if display is not specified. # Get cookie if display is not specified.
if display is None: if display is None:
display = self.REQUEST.cookies.get('display', None) display = self.REQUEST.cookies.get('display', None)
if quality is None: if quality is _MARKER:
quality = self.getDefaultImageQuality(format) quality = self.getDefaultImageQuality(format)
# display may be set from a cookie. # display may be set from a cookie.
image_size = self.getSizeFromImageDisplay(display) image_size = self.getSizeFromImageDisplay(display)
...@@ -269,11 +269,11 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -269,11 +269,11 @@ class Image(TextConvertableMixin, File, OFSImage):
return links return links
security.declareProtected(Permissions.AccessContentsInformation, 'displayMap') security.declareProtected(Permissions.AccessContentsInformation, 'displayMap')
def displayMap(self, exclude=None, format=None, quality=None,\ def displayMap(self, exclude=None, format=None, quality=_MARKER,\
resolution=None): resolution=None):
"""Return list of displays with size info.""" """Return list of displays with size info."""
displays = [] displays = []
if quality is None: if quality is _MARKER:
quality = self.getDefaultImageQuality(format) quality = self.getDefaultImageQuality(format)
for id in self.displayIds(exclude): for id in self.displayIds(exclude):
if self._isGenerated(id, format=format, quality=quality,\ if self._isGenerated(id, format=format, quality=quality,\
...@@ -334,7 +334,10 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -334,7 +334,10 @@ class Image(TextConvertableMixin, File, OFSImage):
image_size = self.getSizeFromImageDisplay(kw.get('display')) image_size = self.getSizeFromImageDisplay(kw.get('display'))
# store all keys usefull to convert or resize an image # store all keys usefull to convert or resize an image
# 'display' parameter can be discarded # 'display' parameter can be discarded
convert_kw = {'quality': kw.get('quality', self.getDefaultImageQuality(format)), quality = kw.get('quality', _MARKER)
if quality is _MARKER:
quality = self.getDefaultImageQuality(format)
convert_kw = {'quality': quality,
'resolution': kw.get('resolution'), 'resolution': kw.get('resolution'),
'frame': kw.get('frame'), 'frame': kw.get('frame'),
'image_size': image_size, 'image_size': image_size,
...@@ -415,10 +418,10 @@ class Image(TextConvertableMixin, File, OFSImage): ...@@ -415,10 +418,10 @@ class Image(TextConvertableMixin, File, OFSImage):
return self.getData() return self.getData()
return self._resize(quality, width, height, format, resolution, frame) return self._resize(quality, width, height, format, resolution, frame)
def _makeDisplayPhoto(self, format=None, quality=None, def _makeDisplayPhoto(self, format=None, quality=_MARKER,
resolution=None, frame=None, image_size=None): resolution=None, frame=None, image_size=None):
"""Create given display.""" """Create given display."""
if quality is None: if quality is _MARKER:
quality = self.getDefaultImageQuality(format) quality = self.getDefaultImageQuality(format)
width, height = image_size width, height = image_size
base, ext = splitext(self.id) base, ext = splitext(self.id)
......
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