[Zope3-checkins] CVS: Zope3/src/zope/app/traversing - __init__.py:1.24 adapters.py:1.15 configure.zcml:1.11

Jim Fulton jim at zope.com
Sun Sep 21 13:31:45 EDT 2003


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

Modified Files:
	__init__.py adapters.py configure.zcml 
Log Message:
No-longer use context wrappers.


=== Zope3/src/zope/app/traversing/__init__.py 1.23 => 1.24 ===
--- Zope3/src/zope/app/traversing/__init__.py:1.23	Fri Jun 13 13:41:20 2003
+++ Zope3/src/zope/app/traversing/__init__.py	Sun Sep 21 13:31:14 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,14 +130,18 @@
     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 = getattr(obj, '__parent__', None)
+    if parent is not None:
+        return parent
+
     raise TypeError("Not enough context information to get parent", obj)
 
+
+
 def getParents(obj):
     """Returns a list starting with the given object's parent followed by
     each of its parents.
@@ -148,17 +151,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.15 ===
--- Zope3/src/zope/app/traversing/adapters.py:1.14	Fri Aug 15 20:44:19 2003
+++ Zope3/src/zope/app/traversing/adapters.py	Sun Sep 21 13:31:14 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.11 ===
--- Zope3/src/zope/app/traversing/configure.zcml:1.10	Sat Aug  2 14:17:25 2003
+++ Zope3/src/zope/app/traversing/configure.zcml	Sun Sep 21 13:31:14 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" />




More information about the Zope3-Checkins mailing list