[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/File/Views/Browser - FileView.py:1.1.2.1 browser.zcml:1.1.2.2

Stephan Richter srichter@cbu.edu
Mon, 4 Mar 2002 00:55:12 -0500


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

Modified Files:
      Tag: srichter-OFS_Formulator-branch
	browser.zcml 
Added Files:
      Tag: srichter-OFS_Formulator-branch
	FileView.py 
Log Message:
Here are some of the changes:

- XML-RPC View for Folders; methods are far from being complete, however
  it is the proof of concept; it works.

- Experimental XUL code in folder that shows a tree, a menu and the limit 
  view.

- File can now be viewed like an Image. Since it also sets the right 
  content type, it is even more useful for some of the development.

- ZPTPages are the last content object to be "formulatorized". Now they 
  also entered the new generation code.

ToDo:

- Make tests.

- Update interfaces.

- Get a client side XML-RPC client talk from the browser with Zope to save
  values. 

- Get a tutorial going, so that the ZMI sprinters and developers can make
  use of the technology



=== Added File Zope3/lib/python/Zope/App/OFS/File/Views/Browser/FileView.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors. 
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (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.
##############################################################################
"""

$Id: FileView.py,v 1.1.2.1 2002/03/04 05:54:41 srichter Exp $
"""

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.response.setHeader('Content-Type',
                                       self.getContext().getContentType())
            REQUEST.response.setHeader('Content-Length',
                                       self.getContext().getSize())

        return self.getContext().getData()
        

    def getContext( self ):
        return self._zptpage
        


=== Zope3/lib/python/Zope/App/OFS/File/Views/Browser/browser.zcml 1.1.2.1 => 1.1.2.2 ===
   <!-- File View Directives -->
 
-  <browser:defaultView name="edit"
+  <browser:defaultView name="view"
+    for="Zope.App.OFS.File.IFile.IFile."
+    factory="Zope.App.OFS.File.Views.Browser.FileView." />
+
+  <security:protectClass 
+    name="Zope.App.OFS.File.Views.Browser.FileView."
+    permission_id="Zope.View" methods="index" />
+
+  <browser:view name="edit"
     for="Zope.App.OFS.File.IFile.IFile."
     factory="Zope.App.OFS.File.Views.Browser.FileEdit." />