[Zope3-checkins] CVS: Zope3/src/zope/app/traversing - __init__.py:1.26 adapters.py:1.17

Jim Fulton jim at zope.com
Sat Mar 6 11:51:02 EST 2004


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

Modified Files:
	__init__.py adapters.py 
Log Message:
Converted most getAdapter calls to use interface calls instead.


=== Zope3/src/zope/app/traversing/__init__.py 1.25 => 1.26 ===
--- Zope3/src/zope/app/traversing/__init__.py:1.25	Fri Mar  5 17:09:19 2004
+++ Zope3/src/zope/app/traversing/__init__.py	Sat Mar  6 11:50:31 2004
@@ -18,7 +18,6 @@
 """
 
 from zope.interface import moduleProvides
-from zope.component import getAdapter
 from zope.app.interfaces.traversing import IContainmentRoot, ITraversalAPI
 from zope.app.interfaces.traversing import ITraverser, IPhysicallyLocatable
 
@@ -61,12 +60,12 @@
 def getPath(obj):
     """Returns a string representing the physical path to the object.
     """
-    return getAdapter(obj, IPhysicallyLocatable).getPath()
+    return IPhysicallyLocatable(obj).getPath()
 
 def getRoot(obj):
     """Returns the root of the traversal for the given object.
     """
-    return getAdapter(obj, IPhysicallyLocatable).getRoot()
+    return IPhysicallyLocatable(obj).getRoot()
 
 def traverse(object, path, default=_marker, request=None):
     """Traverse 'path' relative to the given object.
@@ -85,7 +84,7 @@
           code unexpectedly.
           Consider using traverseName instead.
     """
-    traverser = getAdapter(object, ITraverser)
+    traverser = ITraverser(object)
     if default is _marker:
         return traverser.traverse(path, request=request)
     else:
@@ -121,7 +120,7 @@
 def getName(obj):
     """Get the name an object was traversed via
     """
-    return getAdapter(obj, IPhysicallyLocatable).getName()
+    return IPhysicallyLocatable(obj).getName()
 
 def getParent(obj):
     """Returns the container the object was traversed via.


=== Zope3/src/zope/app/traversing/adapters.py 1.16 => 1.17 ===
--- Zope3/src/zope/app/traversing/adapters.py:1.16	Sun Dec  7 06:31:13 2003
+++ Zope3/src/zope/app/traversing/adapters.py	Sat Mar  6 11:50:31 2004
@@ -21,7 +21,7 @@
 from zope.app.interfaces.traversing import IContainmentRoot
 from zope.app.interfaces.traversing import ITraverser, ITraversable
 
-from zope.component import getAdapter, queryAdapter
+from zope.component import queryAdapter
 
 from zope.app.traversing.namespace import namespaceLookup
 from zope.app.traversing.namespace import UnexpectedParameters
@@ -118,8 +118,7 @@
         if not path[-1]:
             # Start at the root
             pop()
-            curr = getAdapter(self.context, IPhysicallyLocatable
-                              ).getRoot()
+            curr = IPhysicallyLocatable(self.context).getRoot()
         try:
             while path:
                 name = pop()




More information about the Zope3-Checkins mailing list