[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/File/Views/Browser - FileView.py:1.1.2.3.12.1

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


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

Modified Files:
      Tag: Zope3InWonderland-branch
	FileView.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/File/Views/Browser/FileView.py 1.1.2.3 => 1.1.2.3.12.1 ===
 # 
 ##############################################################################
-"""
-
+"""
+
 $Id$
 """
-
-from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
-
-
-class FileView(AttributePublisher):
-
-    __implements__ = AttributePublisher.__implements__
-    
-    def __init__( self, zptpage ):
-        self._zptpage = zptpage
-
-
-    def index(self, REQUEST=None):
-        """Call the File"""
-        if REQUEST is not None:
-            REQUEST.getResponse().setHeader('Content-Type',
-                                       self.getContext().getContentType())
-            REQUEST.getResponse().setHeader('Content-Length',
-                                       self.getContext().getSize())
-
-        return self.getContext().getData()
-        
-
-    def getContext( self ):
-        return self._zptpage
-        
+
+from Zope.Publisher.Browser.BrowserView import BrowserView
+
+
+class FileView(BrowserView):
+
+    def index(self, REQUEST=None):
+        """Call the File"""
+        if REQUEST is not None:
+            REQUEST.getResponse().setHeader('Content-Type',
+                                       self.context.getContentType())
+            REQUEST.getResponse().setHeader('Content-Length',
+                                       self.context.getSize())
+
+        return self.context.getData()
+