[Zope3-checkins] CVS: Zope3/src/zope/app/traversing - __init__.py:1.23.24.1 adapters.py:1.14.6.1 configure.zcml:1.10.10.1 namespace.py:1.19.2.1

Jim Fulton jim at zope.com
Mon Sep 8 15:22:21 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	__init__.py adapters.py configure.zcml namespace.py 
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing.  Specific log entries will be provided
when we merge this into the head.


=== Zope3/src/zope/app/traversing/__init__.py 1.23 => 1.23.24.1 ===
--- Zope3/src/zope/app/traversing/__init__.py:1.23	Fri Jun 13 13:41:20 2003
+++ Zope3/src/zope/app/traversing/__init__.py	Mon Sep  8 14:21:50 2003
@@ -21,7 +21,6 @@
 from zope.component import getAdapter
 from zope.app.interfaces.traversing import IContainmentRoot, ITraversalAPI
 from zope.app.interfaces.traversing import ITraverser, IPhysicallyLocatable
-from zope.context import getWrapperContainer, isWrapper
 
 moduleProvides(ITraversalAPI)
 __all__ = tuple(ITraversalAPI)
@@ -131,12 +130,14 @@
     Raises TypeError if the object doesn't have enough context to get the
     parent.
     """
+    
     if IContainmentRoot.isImplementedBy(obj):
         return None
-    if isWrapper(obj):
-        parent = getWrapperContainer(obj)
-        if parent is not None:
-            return parent
+    
+    parent = obj.__parent__
+    if parent is not None:
+        return parent
+
     raise TypeError("Not enough context information to get parent", obj)
 
 def getParents(obj):
@@ -148,17 +149,19 @@
     """
     if IContainmentRoot.isImplementedBy(obj):
         return []
-    if isWrapper(obj):
-        parents = []
-        w = obj
-        while 1:
-            w = getWrapperContainer(w)
-            if w is None:
-                break
-            parents.append(w)
 
-        if parents and IContainmentRoot.isImplementedBy(parents[-1]):
-            return parents
+    
+    parents = []
+    w = obj
+    while 1:
+        w = w.__parent__
+        if w is None:
+            break
+        parents.append(w)
+
+    if parents and IContainmentRoot.isImplementedBy(parents[-1]):
+        return parents
+
     raise TypeError, "Not enough context information to get all parents"
 
 


=== Zope3/src/zope/app/traversing/adapters.py 1.14 => 1.14.6.1 ===
--- Zope3/src/zope/app/traversing/adapters.py:1.14	Fri Aug 15 20:44:19 2003
+++ Zope3/src/zope/app/traversing/adapters.py	Mon Sep  8 14:21:50 2003
@@ -22,8 +22,6 @@
 from zope.app.interfaces.traversing import ITraverser, ITraversable
 
 from zope.component import getAdapter, queryAdapter
-from zope.context import getInnerWrapperData, getWrapperContainer
-from zope.app.context import ContextWrapper
 
 from zope.app.traversing.namespace import namespaceLookup
 from zope.app.traversing.namespace import UnexpectedParameters
@@ -64,45 +62,6 @@
         else:
             raise NotFoundError(subject, name)
 
-class WrapperPhysicallyLocatable:
-    __doc__ = IPhysicallyLocatable.__doc__
-
-    implements(IPhysicallyLocatable)
-
-    def __init__(self, context):
-        self.context = context
-
-    def getRoot(self):
-        "See IPhysicallyLocatable"
-        container = getWrapperContainer(self.context)
-        if container is None:
-            raise TypeError("Not enough context to determine location root")
-        return getAdapter(container, IPhysicallyLocatable).getRoot()
-
-    def getPath(self):
-        "See IPhysicallyLocatable"
-        context = self.context
-        container = getWrapperContainer(context)
-        if container is None:
-            raise TypeError("Not enough context to determine location")
-        name = getInnerWrapperData(context)['name']
-
-        container = getAdapter(container, IPhysicallyLocatable)
-        container_path = container.getPath()
-
-        if name == '.':
-            # skip
-            return container_path
-
-        if container_path == u'/':
-            return u'/' + name
-        else:
-            return container_path + u'/' + name
-
-    def getName(self):
-        "See IPhysicallyLocatable"
-        return getInnerWrapperData(self.context)['name']
-
 class RootPhysicallyLocatable:
     __doc__ = IPhysicallyLocatable.__doc__
 
@@ -191,8 +150,7 @@
         return obj
 
     if name == '..':
-        # XXX This doesn't look right. Why fall back to obj?
-        obj = getWrapperContainer(obj) or obj
+        obj = obj.__parent__
         return obj
 
     if name and name[:1] in '@+':
@@ -214,7 +172,7 @@
 
     try:
         next_item = traversable.traverse(nm, parms, name, further_path)
-        obj = ContextWrapper(next_item, obj, name=name)
+        obj = next_item
     except NotFoundError:
         if default != _marker:
             return default


=== Zope3/src/zope/app/traversing/configure.zcml 1.10 => 1.10.10.1 ===
--- Zope3/src/zope/app/traversing/configure.zcml:1.10	Sat Aug  2 14:17:25 2003
+++ Zope3/src/zope/app/traversing/configure.zcml	Mon Sep  8 14:21:50 2003
@@ -11,11 +11,6 @@
     provides="zope.app.interfaces.traversing.ITraversable" />
 
 <adapter 
-    for="*"
-    provides="zope.app.interfaces.traversing.IPhysicallyLocatable"
-    factory="zope.app.traversing.adapters.WrapperPhysicallyLocatable" />
-
-<adapter 
     provides="zope.app.interfaces.traversing.IPhysicallyLocatable"
     for="zope.app.interfaces.traversing.IContainmentRoot"
     factory="zope.app.traversing.adapters.RootPhysicallyLocatable" />


=== Zope3/src/zope/app/traversing/namespace.py 1.19 => 1.19.2.1 ===
--- Zope3/src/zope/app/traversing/namespace.py:1.19	Tue Sep  2 16:46:53 2003
+++ Zope3/src/zope/app/traversing/namespace.py	Mon Sep  8 14:21:50 2003
@@ -16,8 +16,6 @@
 """
 
 from zope.exceptions import NotFoundError
-from zope.app.context import ContextWrapper
-from zope.context import getWrapperContext
 from zope.component import queryAdapter
 from zope.component import queryDefaultViewName, queryView, getService
 from zope.app.services.servicenames import Resources
@@ -57,8 +55,6 @@
         raise NotFoundError(name)
 
     new = handler(qname, parameters, name, object, request)
-    if new is not object:
-        new = ContextWrapper(new, object, name=name)
 
     return new
 
@@ -100,7 +96,8 @@
     resource = resource_service.queryResource(ob, name, request)
     if resource is None:
         return default
-    return ContextWrapper(resource, resource_service, name=name)
+    resource.__parent__ = resource_service
+    resource.__name__ = name
 
 
 # ---- namespace processors below ----
@@ -120,13 +117,14 @@
                 # XXX what do we do if the path gets bigger?
                 path = []
                 next = traversable.traverse(name, parameters, pname, path)
-                if path: continue
+                if path:
+                    continue
             except NotFoundError:
                 pass
             else:
-                return ContextWrapper(next, ob, name=name)
+                return next
 
-        ob = getWrapperContext(ob)
+        ob = ob.__parent__
         if ob is None:
             raise NotFoundError(origOb, pname)
 




More information about the Zope3-Checkins mailing list