[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/ZopePublication - PublicationTraverse.py:1.1.2.10.4.1

Gary Poster garyposter@earthlink.net
Mon, 1 Apr 2002 14:29:39 -0500


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

Modified Files:
      Tag: gary-pre_create_views-branch
	PublicationTraverse.py 
Log Message:
hooks.py now can call factories with arguments, and the traverse knows what to do with the ;create namespace



=== Zope3/lib/python/Zope/App/ZopePublication/PublicationTraverse.py 1.1.2.10 => 1.1.2.10.4.1 ===
 from Zope.ContextWrapper import Wrapper
 
+from Zope.App.ZMI.Addable import ContentAddables # gp
+from Zope.App.OFS.Container.IContainer import IWriteContainer
+
 class DuplicateNamespaces(Exception):
     """More than one namespave was specified in a request"""
     
@@ -148,6 +151,15 @@
             if r is None:
                 raise NotFound(ob, name, request)
         raise ExcessiveWrapping(ob, name, request)
+    
+    def _traversecreate(self, request, ob, name): # gp
+        if IWriteContainer.isImplementedBy(ob):  # so we definitely have
+            # a "setObject" available for the create
+            for addable in ContentAddables.getAddables(ob):
+                if addable.id() == name:
+                    return addable
+        raise NotFound(ob, name, request)
+        
 
 class PublicationTraverser(PublicationTraverse):