[Zope3-checkins] CVS: Zope3/src/zope/app/traversing - __init__.py:1.6 adapters.py:1.2 namespace.py:1.2

Steve Alexander steve@cat-box.net
Mon, 30 Dec 2002 11:11:58 -0500


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

Modified Files:
	__init__.py adapters.py namespace.py 
Log Message:
removed circular import problem.


=== Zope3/src/zope/app/traversing/__init__.py 1.5 => 1.6 ===
--- Zope3/src/zope/app/traversing/__init__.py:1.5	Sat Dec 28 12:49:33 2002
+++ Zope3/src/zope/app/traversing/__init__.py	Mon Dec 30 11:11:57 2002
@@ -17,8 +17,6 @@
 from zope.component import getAdapter
 from zope.app.interfaces.traversing import IObjectName, IContainmentRoot
 from zope.app.interfaces.traversing import ITraverser, IPhysicallyLocatable
-# XXX moved to later on to avoid byzantine circular import
-#from zope.app.traversing.adapters import Traverser
 from zope.proxy.context import getWrapperContext, isWrapper
 from zope.proxy.context import getWrapperContainer
 from types import StringTypes
@@ -29,6 +27,22 @@
 
 _marker = object()
 
+def getPhysicalPath(obj):
+    """Returns a tuple of names representing the physical path to the object.
+    """
+    return getAdapter(obj, IPhysicallyLocatable).getPhysicalPath()
+
+def getPhysicalPathString(obj):
+    """Returns a string representing the physical path to the object.
+    """
+    path = getAdapter(obj, IPhysicallyLocatable).getPhysicalPath()
+    return locationAsUnicode(path)
+
+def getPhysicalRoot(obj):
+    """Returns the root of the traversal for the given object.
+    """
+    return getAdapter(obj, IPhysicallyLocatable).getPhysicalRoot()
+
 def traverse(place, path, default=_marker, request=None):
     """Traverse 'path' relative to 'place'
 
@@ -47,7 +61,6 @@
           code unexpectedly.
           Consider using traverseName instead.
     """
-    from zope.app.traversing.adapters import Traverser
     traverser = Traverser(place)
     if default is _marker:
         return traverser.traverse(path, request=request)
@@ -115,22 +128,6 @@
             return parents
     raise TypeError, "Not enough context information to get all parents"
 
-def getPhysicalPath(obj):
-    """Returns a tuple of names representing the physical path to the object.
-    """
-    return getAdapter(obj, IPhysicallyLocatable).getPhysicalPath()
-
-def getPhysicalPathString(obj):
-    """Returns a string representing the physical path to the object.
-    """
-    path = getAdapter(obj, IPhysicallyLocatable).getPhysicalPath()
-    return locationAsUnicode(path)
-
-def getPhysicalRoot(obj):
-    """Returns the root of the traversal for the given object.
-    """
-    return getAdapter(obj, IPhysicallyLocatable).getPhysicalRoot()
-
 def locationAsTuple(location):
     """Given a location as a unicode or ascii string or as a tuple of
     unicode or ascii strings, returns the location as a tuple of
@@ -184,3 +181,5 @@
         raise ValueError("location must not contain // : %s" % u)
     return u
 
+# import this down here to avoid circular imports
+from zope.app.traversing.adapters import Traverser


=== Zope3/src/zope/app/traversing/adapters.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/traversing/adapters.py:1.1	Sat Dec 28 12:49:33 2002
+++ Zope3/src/zope/app/traversing/adapters.py	Mon Dec 30 11:11:57 2002
@@ -203,3 +203,4 @@
             if default == _marker:
                 raise
             return default
+


=== Zope3/src/zope/app/traversing/namespace.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/traversing/namespace.py:1.1	Sat Dec 28 12:49:33 2002
+++ Zope3/src/zope/app/traversing/namespace.py	Mon Dec 30 11:11:57 2002
@@ -25,9 +25,6 @@
 from zope.component import queryDefaultViewName, getView, getService
 
 from zope.app.interfaces.traversing import ITraversable
-from zope.app.applicationcontrol.applicationcontrol \
-    import applicationController
-from zope.app.content.folder import RootFolder
 from zope.app.interfaces.services.service import INameResolver
 
 import re
@@ -175,6 +172,9 @@
         raise UnexpectedParameters(parameters)
     return ob[name]
 
+from zope.app.applicationcontrol.applicationcontrol \
+    import applicationController
+from zope.app.content.folder import RootFolder
 def etc(name, parameters, pname, ob, request):
     # XXX