[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/Image/Views/Browser - ImageData.py:1.1.2.4.4.1 ImageEdit.py:1.1.2.4.4.1

Jim Fulton jim@zope.com
Wed, 29 May 2002 11:10:11 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/Image/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv12181/lib/python/Zope/App/OFS/Content/Image/Views/Browser

Modified Files:
      Tag: Zope3InWonderland-branch
	ImageData.py ImageEdit.py 
Log Message:
- Added permission_id attribute to adapter and utility directives.

- Got rid of old getView, getResource, and getDefaultViewName.
  Renamed getRequestView to getView (and so on).

  Changed view interface to use context, rather than getContext.

  Introduced notion of presentation types (e.g. IBrowserPresentation, 
  which is cleaner than IBrowserPublisher).

- Began converting to get/queryFoo, which is much nicer.

- Many formatting fixups.



=== Zope3/lib/python/Zope/App/OFS/Content/Image/Views/Browser/ImageData.py 1.1.2.4 => 1.1.2.4.4.1 ===
 """
 
-from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
+from Zope.Publisher.Browser.BrowserView import BrowserView
 from Zope.App.PageTemplate import ViewPageTemplateFile
 
-class ImageData(AttributePublisher):
-
-    __implements__ = AttributePublisher.__implements__
-    
-    def __init__( self, image ):
-        self._image = image
-
+class ImageData(BrowserView):
 
     def index(self, REQUEST=None):        
-        image = self.getContext()
+        image = self.context
         if REQUEST is not None:
             REQUEST.getResponse().setHeader('content-type',
                                           image.getContentType()) 
@@ -53,9 +47,9 @@
         'class' in the output tag to work around this.
         """
         if width is None:
-            width=self.getContext().getImageSize()[0]
+            width=self.context.getImageSize()[0]
         if height is None:
-            height = self.getContext().getImageSize()[1]
+            height = self.context.getImageSize()[1]
 
         # Auto-scaling support
         xdelta = xscale or scale
@@ -89,7 +83,3 @@
             result = '%s %s="%s"' % (result, key, value)
 
         return '%s />' % result
-
-
-    def getContext(self):
-        return self._image


=== Zope3/lib/python/Zope/App/OFS/Content/Image/Views/Browser/ImageEdit.py 1.1.2.4 => 1.1.2.4.4.1 ===
     
     def getImageSize(self):
-        size=self.getContext().getImageSize()
+        size=self.context.getImageSize()
         return "%d x %d" % (size[0], size[1])