[Zope3-checkins] CVS: Zope3/src/zope/app/apidoc - __init__.py:1.8 configure.zcml:1.3

Jim Fulton jim at zope.com
Sun Apr 18 12:01:01 EDT 2004


Update of /cvs-repository/Zope3/src/zope/app/apidoc
In directory cvs.zope.org:/tmp/cvs-serv12900/src/zope/app/apidoc

Modified Files:
	__init__.py configure.zcml 
Log Message:
Changed way namespace handlers (handlers for traversing names of the
form "++namespace++name") are registered.  Now the are registered as
views and adapters.  When traversing a namespace-qualified view, a
request is sometimes provided.  When a request is provided, a view
will be used to traverse the name. Otherwise, an adapter is used.
handlers that don't care about the request are registered as both an
adapter and a view.

With this change, it's not possible to have content-specific
namespace-specific traversers.  Content objects can now define
specialized namespaces.


=== Zope3/src/zope/app/apidoc/__init__.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/apidoc/__init__.py:1.7	Sat Apr 17 13:15:31 2004
+++ Zope3/src/zope/app/apidoc/__init__.py	Sun Apr 18 12:00:30 2004
@@ -68,7 +68,15 @@
             utils.append((key, value))
         return utils
         
+class apidocNamespace:
+    """Used to traverse to an API Documentation."""
+    def __init__(self, ob, request=None):
+        self.context = ob
+        
+    def traverse(self, name, ignore):
+        return handleNamespace(self.context, name)
 
-def handleNamespace(name, ob, request):
+def handleNamespace(ob, name):
     """Used to traverse to an API Documentation."""
     return APIDocumentation(ob, '++apidoc++'+name)
+    


=== Zope3/src/zope/app/apidoc/configure.zcml 1.2 => 1.3 ===
--- Zope3/src/zope/app/apidoc/configure.zcml:1.2	Wed Mar  3 05:38:30 2004
+++ Zope3/src/zope/app/apidoc/configure.zcml	Sun Apr 18 12:00:30 2004
@@ -9,9 +9,17 @@
         />
   </class>
 
-  <traversalNamespace
+  <view
       name="apidoc"
-      handler=".handleNamespace" />
+      type="zope.interface.Interface"
+      provides="zope.app.traversing.interfaces.ITraversable" for="*"
+      factory=".apidocNamespace"
+      />
+  <adapter
+      name="apidoc"
+      provides="zope.app.traversing.interfaces.ITraversable" for="*"
+      factory=".apidocNamespace"
+      />
 
   <include package=".browser" />
 




More information about the Zope3-Checkins mailing list