[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS - SOAPContainerTraverser.py:1.1.2.1 ofs.zcml:1.1.2.1.2.3

Stephan Richter srichter@cbu.edu
Wed, 13 Mar 2002 05:57:59 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS
In directory cvs.zope.org:/tmp/cvs-serv11175/lib/python/Zope/App/OFS

Modified Files:
      Tag: srichter-OFS_Formulator-branch
	ofs.zcml 
Added Files:
      Tag: srichter-OFS_Formulator-branch
	SOAPContainerTraverser.py 
Log Message:
- Added some more tests. Won;t do more, since Publisher is being redesigned
  later this week. I will wait until then.

- Added preliminary SOAP support, so we can test Mozilla's SOAP 
  capabilities. Unfortunately, soaplib is very old; I will look into using 
  SOAPpy instead. It seems fairly complete.


=== Added File Zope3/lib/python/Zope/App/OFS/SOAPContainerTraverser.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.SOAP.ISOAPPublisher import ISOAPPublisher
from Zope.Publisher.Exceptions import NotFound
from IContainer import IReadContainer
from Zope.ComponentArchitecture import getRequestView
from Zope.ComponentArchitecture import getRequestDefaultViewName


class SOAPContainerTraverser:

    __implements__ = ISOAPPublisher
    __used_for__ = IReadContainer

    def __init__(self, c):
        self._c = c

    def soap_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 soap_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.2 => 1.1.2.1.2.3 ===
    xmlns:browser='http://namespaces.zope.org/browser'
    xmlns:xmlrpc='http://namespaces.zope.org/xmlrpc'
+   xmlns:soap='http://namespaces.zope.org/soap'
 >
 
   <include package="Zope.App.OFS.Folder" file="folder.zcml" />
@@ -18,6 +19,10 @@
   <xmlrpc:view name="_traverse" 
     for="Zope.App.OFS.IContainer."
     factory="Zope.App.OFS.XMLRPCContainerTraverser." />
+
+  <soap:view name="_traverse" 
+    for="Zope.App.OFS.IContainer."
+    factory="Zope.App.OFS.SOAPContainerTraverser." />
 
   <adapter factory="Zope.App.OFS.ContainerTraversable."
            provides="Zope.App.Traversing.ITraversable."