From 437481dc6d19cdfd91063fa92f2d7e53cc1460ed Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Wed, 21 Jul 2010 13:14:23 +0000 Subject: [PATCH] Make it a global method so it can be used by OOoDocument (work in progress). git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@37216 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Image.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/product/ERP5/Document/Image.py b/product/ERP5/Document/Image.py index f83d95595e..6bf382d505 100644 --- a/product/ERP5/Document/Image.py +++ b/product/ERP5/Document/Image.py @@ -54,6 +54,10 @@ from zLOG import LOG, WARNING from Products.ERP5.mixin.text_convertable import TextConvertableMixin from Products.CMFCore.utils import getToolByName +def getDefaultImageQuality(portal, format=None): + preference_tool = portal.portal_preferences + return preference_tool.getPreference('preferred_image_quality', DEFAULT_IMAGE_QUALITY) + class Image(TextConvertableMixin, File, OFSImage): """ An Image is a File which contains image data. It supports @@ -337,6 +341,7 @@ class Image(TextConvertableMixin, File, OFSImage): quality = kw.get('quality', _MARKER) if quality is _MARKER: quality = self.getDefaultImageQuality(format) + #print "image._convert", kw, quality, self.getRelativeUrl(), self.getPortalType() convert_kw = {'quality': quality, 'resolution': kw.get('resolution'), 'frame': kw.get('frame'), @@ -483,6 +488,4 @@ class Image(TextConvertableMixin, File, OFSImage): """ Get default image quality for a format. """ - preference_tool = self.getPortalObject().portal_preferences - quality = preference_tool.getPreference('preferred_image_quality', DEFAULT_IMAGE_QUALITY) - return quality + return getDefaultImageQuality(self.getPortalObject(), format) -- 2.30.9