[Zope3-checkins]
SVN: Zope3/trunk/src/zope/app/file/browser/image.py
Simplify how the image size display is generated for the Upload tab.
Fred L. Drake, Jr.
fred at zope.com
Thu Jul 1 17:36:03 EDT 2004
Log message for revision 26039:
Simplify how the image size display is generated for the Upload tab.
This re-uses the existing display support from ImageSized, so takes
advantage of any localization of the messages provided for that.
Closes collector issue 218; merged from the ZopeX3-3.0 branch, revision 26038.
-=-
Modified: Zope3/trunk/src/zope/app/file/browser/image.py
===================================================================
--- Zope3/trunk/src/zope/app/file/browser/image.py 2004-07-01 21:34:32 UTC (rev 26038)
+++ Zope3/trunk/src/zope/app/file/browser/image.py 2004-07-01 21:36:03 UTC (rev 26039)
@@ -15,7 +15,9 @@
$Id$
"""
+from zope.app import zapi
from zope.app.size import byteDisplay
+from zope.app.size.interfaces import ISized
class ImageData(object):
@@ -85,11 +87,5 @@
"""Image edit view mix-in that provides access to image size info"""
def size(self):
- sx, sy = self.context.getImageSize()
- if sx < 0:
- sx = '?'
- if sy < 0:
- sy = '?'
- return "%s x %s pixels, %s" % (
- sx, sy, byteDisplay(self.context.getSize())
- )
+ sized = zapi.getAdapter(self.context, ISized)
+ return sized.sizeForDisplay()
More information about the Zope3-Checkins
mailing list