From f172b5dcc215da7cd4e0028ad5f8b88d7fe56847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Thu, 13 Mar 2008 13:03:30 +0000 Subject: [PATCH] export a method so that skins can access image size for a given image_display. This is used in odt_style to display ImageFields git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19847 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/Image.py | 7 +++++++ product/ERP5/__init__.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/product/ERP5/Document/Image.py b/product/ERP5/Document/Image.py index 4fec159e7d..7286a6c7eb 100644 --- a/product/ERP5/Document/Image.py +++ b/product/ERP5/Document/Image.py @@ -61,6 +61,13 @@ defaultdisplays = {'nano' : (25,25), 'xlarge' : (1024,1024) } +def getSizeFromImageDisplay(image_display): + """Retuns the size for this image display, or None if this image display name + is not known. + """ + return defaultdisplays.get(image_display) + + default_formats = ['jpg', 'jpeg', 'png', 'gif', 'pnm', 'ppm'] class Image(File, OFSImage): diff --git a/product/ERP5/__init__.py b/product/ERP5/__init__.py index b9b1b2efa5..62e2d348f6 100644 --- a/product/ERP5/__init__.py +++ b/product/ERP5/__init__.py @@ -91,6 +91,8 @@ def initialize( context ): 'Redirect', 'Unauthorized') ModuleSecurityInfo('Products.CMFCore.WorkflowCore').declarePublic( 'WorkflowException') + ModuleSecurityInfo('Products.ERP5.Document.Image').declarePublic( + 'getSizeFromImageDisplay') # backward compatibility names XML = None -- 2.30.9