[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS - XMLRPCContainerTraverser.py:1.1.2.1 ofs.zcml:1.1.2.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
In directory cvs.zope.org:/tmp/cvs-serv25134
Modified Files:
Tag: srichter-OFS_Formulator-branch
ofs.zcml
Added Files:
Tag: srichter-OFS_Formulator-branch
XMLRPCContainerTraverser.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/XMLRPCContainerTraverser.py ===
# Copyright (c) 2001 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.
"""
Define view component for folder contents.
"""
import os
from Zope.Publisher.XMLRPC.IXMLRPCPublisher import IXMLRPCPublisher
from Zope.Publisher.Exceptions import NotFound
from IContainer import IReadContainer
from Zope.ComponentArchitecture import getRequestView
from Zope.ComponentArchitecture import getRequestDefaultViewName
class XMLRPCContainerTraverser:
__implements__ = IXMLRPCPublisher
__used_for__ = IReadContainer
def __init__(self, c):
self._c = c
def xmlrpc_traverse(self, request, name):
c = self._c
if name.endswith(';view'):
p = getRequestView(c, name[:-5], request)
if p is None:
raise NotFound(c, name, request)
else:
return p
subob = c.getObject(name, None)
if subob is None:
raise NotFound(c, name, request)
return subob
def xmlrpc_default(self, request):
"""
"""
c = self._c
view_name = getRequestDefaultViewName(c, request)
view_uri = "%s;view" % view_name
return c, (view_uri,)
=== Zope3/lib/python/Zope/App/OFS/ofs.zcml 1.1.2.1.2.1 => 1.1.2.1.2.2 ===
xmlns:zmi='http://namespaces.zope.org/zmi'
xmlns:browser='http://namespaces.zope.org/browser'
+ xmlns:xmlrpc='http://namespaces.zope.org/xmlrpc'
>
-<include package="Zope.App.OFS.Folder" file="folder.zcml" />
-<include package="Zope.App.OFS.File" file="file.zcml" />
-<include package="Zope.App.OFS.Image" file="image.zcml" />
-<include package="Zope.App.OFS.ZPTPage" file="zptpage.zcml" />
+ <include package="Zope.App.OFS.Folder" file="folder.zcml" />
+ <include package="Zope.App.OFS.File" file="file.zcml" />
+ <include package="Zope.App.OFS.Image" file="image.zcml" />
+ <include package="Zope.App.OFS.ZPTPage" file="zptpage.zcml" />
-<browser:view name="_traverse"
- for="Zope.App.OFS.IContainer."
- factory="Zope.App.OFS.ContainerTraverser.ContainerTraverser." />
+ <browser:view name="_traverse"
+ for="Zope.App.OFS.IContainer."
+ factory="Zope.App.OFS.ContainerTraverser." />
-<adapter factory="Zope.App.OFS.ContainerTraversable."
- provides="Zope.App.Traversing.ITraversable."
- for="Zope.App.OFS.IContainer.IReadContainer." />
+ <xmlrpc:view name="_traverse"
+ for="Zope.App.OFS.IContainer."
+ factory="Zope.App.OFS.XMLRPCContainerTraverser." />
+
+ <adapter factory="Zope.App.OFS.ContainerTraversable."
+ provides="Zope.App.Traversing.ITraversable."
+ for="Zope.App.OFS.IContainer.IReadContainer." />
</zopeConfigure>