Commit 8d61273c authored by Ivan Tyagov's avatar Ivan Tyagov

Use already existing system preference and created accessor rather than hard...

Use already existing system preference and created accessor rather than hard coded value which was different from
default for the system preference
This can lead to different cache ids generated for same content by different
parts of the code -> duplication of same data in cache backend.
parent 2c11b76a
...@@ -75,8 +75,8 @@ VALID_TRANSPARENT_IMAGE_FORMAT_LIST = ('png', 'gif', 'tiff', 'svg') ...@@ -75,8 +75,8 @@ VALID_TRANSPARENT_IMAGE_FORMAT_LIST = ('png', 'gif', 'tiff', 'svg')
DEFAULT_DISPLAY_ID_LIST = ('nano', 'micro', 'thumbnail', DEFAULT_DISPLAY_ID_LIST = ('nano', 'micro', 'thumbnail',
'xsmall', 'small', 'medium', 'xsmall', 'small', 'medium',
'large', 'xlarge',) 'large', 'xlarge',)
# default image quality # default image qualitay (obsoleted use getPreferredImageQuality on a portal_preferences tool)
DEFAULT_IMAGE_QUALITY = 75 DEFAULT_IMAGE_QUALITY = 75.0
DEFAULT_CONTENT_TYPE = 'text/html' DEFAULT_CONTENT_TYPE = 'text/html'
......
...@@ -45,7 +45,7 @@ from Products.ERP5Type.Utils import fill_args_from_request ...@@ -45,7 +45,7 @@ from Products.ERP5Type.Utils import fill_args_from_request
from Products.ERP5.Document.File import File from Products.ERP5.Document.File import File
from Products.ERP5.Document.Document import Document, ConversionError,\ from Products.ERP5.Document.Document import Document, ConversionError,\
VALID_TEXT_FORMAT_LIST, VALID_TRANSPARENT_IMAGE_FORMAT_LIST,\ VALID_TEXT_FORMAT_LIST, VALID_TRANSPARENT_IMAGE_FORMAT_LIST,\
DEFAULT_DISPLAY_ID_LIST, DEFAULT_IMAGE_QUALITY, _MARKER DEFAULT_DISPLAY_ID_LIST, _MARKER
from os.path import splitext from os.path import splitext
from OFS.Image import Image as OFSImage from OFS.Image import Image as OFSImage
from OFS.Image import getImageInfo from OFS.Image import getImageInfo
...@@ -58,7 +58,7 @@ from Products.ERP5.mixin.text_convertable import TextConvertableMixin ...@@ -58,7 +58,7 @@ from Products.ERP5.mixin.text_convertable import TextConvertableMixin
def getDefaultImageQuality(portal, format=None): def getDefaultImageQuality(portal, format=None):
preference_tool = portal.portal_preferences preference_tool = portal.portal_preferences
return preference_tool.getPreference('preferred_image_quality', DEFAULT_IMAGE_QUALITY) return preference_tool.getPreferredImageQuality()
class Image(TextConvertableMixin, File, OFSImage): class Image(TextConvertableMixin, File, OFSImage):
""" """
......
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