Commit 3fe0d72f authored by Nicolas Delaby's avatar Nicolas Delaby

Caching this method has no effect because getPreference is allready cached

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20767 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 4eb3510f
...@@ -41,7 +41,6 @@ from Acquisition import aq_base ...@@ -41,7 +41,6 @@ from Acquisition import aq_base
from DocumentTemplate.DT_Util import html_quote from DocumentTemplate.DT_Util import html_quote
from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5.Document.File import File from Products.ERP5.Document.File import File
from Products.ERP5.Document.Document import ConversionError from Products.ERP5.Document.Document import ConversionError
...@@ -473,21 +472,15 @@ class Image(File, OFSImage): ...@@ -473,21 +472,15 @@ class Image(File, OFSImage):
"""Retuns the size for this image display, or None if this image display name """Retuns the size for this image display, or None if this image display name
is not known. is not known.
""" """
def getDefaultDisplayAsDict(): preference_tool = self.getPortalObject().portal_preferences
preference_tool = self.getPortalObject().portal_preferences default_displays = dict()
defaultdisplays = dict() for id in default_displays_id_list:
for id in default_displays_id_list: height_preference = 'preferred_%s_image_height' % (id)
height_preference = 'preferred_%s_image_height' % (id) width_preferece = 'preferred_%s_image_width' % (id)
width_preferece = 'preferred_%s_image_width' % (id) image_size = (preference_tool.getPreference(height_preference),
size_list = (preference_tool.getPreference(height_preference), preference_tool.getPreference(width_preferece))
preference_tool.getPreference(width_preferece)) default_displays.setdefault(id, image_size)
defaultdisplays.setdefault(id, size_list) return default_displays.get(image_display, None)
return defaultdisplays
Cached_getDefaultDisplayAsDict = CachingMethod(getDefaultDisplayAsDict,
id='Image_getDefaultDisplayAsDict',
cache_factory='erp5_ui_long')
defaultdisplays = Cached_getDefaultDisplayAsDict()
return defaultdisplays.get(image_display)
# #
# FTP/WebDAV support # FTP/WebDAV support
......
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