[Zope3-checkins] CVS: Zope3/src/zope/app/browser/content - image.py:1.1.2.2

Fred L. Drake, Jr. fred@zope.com
Tue, 24 Dec 2002 02:19:45 -0500


Update of /cvs-repository/Zope3/src/zope/app/browser/content
In directory cvs.zope.org:/tmp/cvs-serv21873

Modified Files:
      Tag: NameGeddon-branch
	image.py 
Log Message:
- fix & clean up imports
- general cleanup, normalize whitespace


=== Zope3/src/zope/app/browser/content/image.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/app/browser/content/image.py:1.1.2.1	Mon Dec 23 14:31:04 2002
+++ Zope3/src/zope/app/browser/content/image.py	Tue Dec 24 02:19:45 2002
@@ -2,33 +2,36 @@
 #
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
-# 
+#
 # This software is subject to the provisions of the Zope Public License,
 # Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
-# 
+#
 ##############################################################################
 """ Define view component for naive file editing.
 
 $Id$
 """
 
+from zope.app.browser.content.file import FileUpload
+from zope.app.event.objectevent import ObjectModifiedEvent
+from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
+from zope.event import publish
 from zope.publisher.browser import BrowserView
-from Zope.App.PageTemplate import ViewPageTemplateFile
+
 
 class ImageData(BrowserView):
 
-    def __call__(self):        
+    def __call__(self):
         image = self.context
         if self.request is not None:
             self.request.response.setHeader('content-type',
-                                                 image.getContentType()) 
+                                            image.getContentType())
         return image.getData()
 
-
     def tag(self, height=None, width=None, alt=None,
             scale=0, xscale=0, yscale=0, css_class=None, **args):
         """
@@ -47,7 +50,7 @@
         'class' in the output tag to work around this.
         """
         if width is None:
-            width=self.context.getImageSize()[0]
+            width = self.context.getImageSize()[0]
         if height is None:
             height = self.context.getImageSize()[1]
 
@@ -60,10 +63,10 @@
         if ydelta and height:
             height = str(int(round(int(height) * ydelta)))
 
-        result='<img src="%s"' % (self.absolute_url())
+        result = '<img src="%s"' % (self.absolute_url())
 
         if alt is None:
-            alt=getattr(self, 'title', '')
+            alt = getattr(self, 'title', '')
         result = '%s alt="%s"' % (result, alt)
 
         if height is not None:
@@ -85,21 +88,12 @@
         return '%s />' % result
 
 
-"""Define view component for image editing.
-
-$Id$
-"""
-from zope.app.browser.content.file import FileUpload
-from zope.event import publish
-from zope.app.event.objectevent import ObjectModifiedEvent
-
 class ImageUpload(FileUpload):
     """Image edit view mix-in that provides access to image size info"""
 
     def size(self):
         sx, sy = self.context.getImageSize()
         return "%s x %s pixels" % (sx > 0 and sx or 0, sx > 0 and sy or 0)
-            
 
     def apply_update(self, data):
         """Apply user inputs
@@ -123,7 +117,7 @@
         if 'data' in data:
             self.context.data = data['data']
             unchanged = False
-        
+
         if not unchanged:
             publish(self.context, ObjectModifiedEvent(self.context))