[Zope3-checkins] CVS: Zope3/src/zope/app/traversing - __init__.py:1.3 acquirenamespace.py:1.3 defaulttraversable.py:1.3 objectname.py:1.3 physicallocationadapters.py:1.3 traverser.py:1.3

Steve Alexander steve@cat-box.net
Sat, 28 Dec 2002 09:14:00 -0500


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

Modified Files:
	__init__.py acquirenamespace.py defaulttraversable.py 
	objectname.py physicallocationadapters.py traverser.py 
Log Message:
Made the zope.app.interfaces.traversing package into a single
traversing.py file. Corrected (shortened!) the imports that refered to
this package.
Also, made the imports of zope.app.traversing.__init__ a bit simpler.


=== Zope3/src/zope/app/traversing/__init__.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/traversing/__init__.py:1.2	Wed Dec 25 09:13:26 2002
+++ Zope3/src/zope/app/traversing/__init__.py	Sat Dec 28 09:13:28 2002
@@ -1,3 +1,4 @@
+##############################################################################
 #
 # Copyright (c) 2001, 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
@@ -13,17 +14,17 @@
 """
 Traversing the object tree.
 """
-# being careful not to pollute the namespace unnecessarily...
-from zope.component import getAdapter as _getAdapter
-from objectname import IObjectName as _IObjectName
-from zope.app.interfaces.traversing.traverser import ITraverser as _ITraverser
-from zope.app.interfaces.traversing.physicallylocatable \
-     import IPhysicallyLocatable as _IPhysicallyLocatable
-from traverser import WrapperChain as _WrapperChain
-from traverser import Traverser as _Traverser
-from zope.proxy.context import getWrapperContext as _getWrapperContext
-from zope.proxy.context import isWrapper as _isWrapper
+from zope.component import getAdapter
+from zope.app.interfaces.traversing import IObjectName
+from zope.app.interfaces.traversing import ITraverser, IPhysicallyLocatable
+from zope.app.traversing.traverser import WrapperChain, Traverser
+from zope.proxy.context import getWrapperContext, isWrapper
 from types import StringTypes
+
+__all__ = ['traverse', 'traverseName', 'objectName', 'getParent',
+           'getParents', 'getPhysicalPath', 'getPhysicalPathString',
+           'getPhysicalRoot', 'locationAsTuple', 'locationAsUnicode']
+
 _marker = object()
 
 # XXX: this probably shouldn't have "request" in its signature, nor
@@ -43,7 +44,7 @@
           code unexpectedly.
           Consider using traverseName instead.
     """
-    traverser = _Traverser(place)
+    traverser = Traverser(place)
     if default is _marker:
         return traverser.traverse(path, request=request)
     else:
@@ -72,26 +73,24 @@
 
     Raises TypeError if the object is not context-wrapped
     """
-    return _getAdapter(obj, _IObjectName)()
+    return getAdapter(obj, IObjectName)()
 
 def getParent(obj):
     """Returns the container the object was traversed via.
 
     Raises TypeError if the given object is not context wrapped
     """
-    if not _isWrapper(obj):
+    if not isWrapper(obj):
         raise TypeError, "Not enough context information to traverse"
-    return _getWrapperContext(obj)
+    return getWrapperContext(obj)
 
 def getParents(obj):
     """Returns a list starting with the given object's parent followed by
     each of its parents.
-
-    Raises TypeError if the given object is not context wrapped
     """
-    if not _isWrapper(obj):
+    if not isWrapper(obj):
         raise TypeError, "Not enough context information to traverse"
-    iterator = _WrapperChain(obj)
+    iterator = WrapperChain(obj)
     iterator.next()  # send head of chain (current object) to /dev/null
     return [p for p in iterator]
 
@@ -100,14 +99,14 @@
 
     Raises TypeError if the given object is not context wrapped
     """
-    return _getAdapter(obj, _IPhysicallyLocatable).getPhysicalPath()
+    return getAdapter(obj, IPhysicallyLocatable).getPhysicalPath()
 
 def getPhysicalPathString(obj):
     """Returns a string representing the physical path to the object.
 
     Raises TypeError if the given object is not context wrapped
     """
-    path = _getAdapter(obj, _IPhysicallyLocatable).getPhysicalPath()
+    path = getAdapter(obj, IPhysicallyLocatable).getPhysicalPath()
     return locationAsUnicode(path)
 
 
@@ -116,7 +115,7 @@
 
     Raises TypeError if the given object is not context wrapped
     """
-    return _getAdapter(obj, _IPhysicallyLocatable).getPhysicalRoot()
+    return getAdapter(obj, IPhysicallyLocatable).getPhysicalRoot()
 
 def locationAsTuple(location):
     """Given a location as a unicode or ascii string or as a tuple of
@@ -169,3 +168,4 @@
     # don't usually need this, so just an assertion rather than a value error
     assert u.find(u'//') == -1
     return u
+


=== Zope3/src/zope/app/traversing/acquirenamespace.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/traversing/acquirenamespace.py:1.2	Wed Dec 25 09:13:26 2002
+++ Zope3/src/zope/app/traversing/acquirenamespace.py	Sat Dec 28 09:13:28 2002
@@ -21,7 +21,7 @@
 from zope.exceptions import NotFoundError
 from zope.component import queryAdapter
 from zope.proxy.context import ContextWrapper, getWrapperContext
-from zope.app.interfaces.traversing.traversable import ITraversable
+from zope.app.interfaces.traversing import ITraversable
 
 class ExcessiveWrapping(NotFoundError):
     """Too many levels of acquisition wrapping. We don't believe them."""


=== Zope3/src/zope/app/traversing/defaulttraversable.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/traversing/defaulttraversable.py:1.2	Wed Dec 25 09:13:26 2002
+++ Zope3/src/zope/app/traversing/defaulttraversable.py	Sat Dec 28 09:13:28 2002
@@ -1,6 +1,6 @@
 ##############################################################################
 #
-# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
+# Copyright (c) 2002 Zope Corporation and Contributors.
 # All Rights Reserved.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -11,7 +11,11 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-from zope.app.interfaces.traversing.traversable import ITraversable
+"""
+$Id$
+"""
+
+from zope.app.interfaces.traversing import ITraversable
 from zope.exceptions import NotFoundError
 from zope.app.traversing.exceptions import UnexpectedParameters
 


=== Zope3/src/zope/app/traversing/objectname.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/traversing/objectname.py:1.2	Wed Dec 25 09:13:26 2002
+++ Zope3/src/zope/app/traversing/objectname.py	Sat Dec 28 09:13:28 2002
@@ -17,7 +17,7 @@
 $Id$
 """
 from zope.proxy.context import getInnerWrapperData
-from zope.app.interfaces.traversing.objectname import IObjectName
+from zope.app.interfaces.traversing import IObjectName
 
 class ObjectName(object):
 


=== Zope3/src/zope/app/traversing/physicallocationadapters.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/traversing/physicallocationadapters.py:1.2	Wed Dec 25 09:13:26 2002
+++ Zope3/src/zope/app/traversing/physicallocationadapters.py	Sat Dec 28 09:13:28 2002
@@ -19,8 +19,8 @@
 """
 __metaclass__ = type
 
-from zope.app.interfaces.traversing.physicallylocatable import IPhysicallyLocatable
-from zope.app.interfaces.traversing.containmentroot import IContainmentRoot
+from zope.app.interfaces.traversing import IPhysicallyLocatable
+from zope.app.interfaces.traversing import IContainmentRoot
 from zope.component import getAdapter
 from zope.proxy.context import getInnerWrapperData, getWrapperContainer
 


=== Zope3/src/zope/app/traversing/traverser.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/traversing/traverser.py:1.2	Wed Dec 25 09:13:26 2002
+++ Zope3/src/zope/app/traversing/traverser.py	Sat Dec 28 09:13:28 2002
@@ -24,9 +24,8 @@
 from zope.app.traversing.namespaces import namespaceLookup
 from zope.app.traversing.parameterparsing import parameterizedNameParse
 
-from zope.app.interfaces.traversing.physicallylocatable import IPhysicallyLocatable
-from zope.app.interfaces.traversing.traverser import ITraverser
-from zope.app.interfaces.traversing.traversable import ITraversable
+from zope.app.interfaces.traversing import IPhysicallyLocatable
+from zope.app.interfaces.traversing import ITraverser, ITraversable
 
 from types import StringTypes