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

Albertas Agejevas alga@codeworks.lt
Wed, 19 Mar 2003 14:58:05 -0500


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

Modified Files:
	__init__.py adapters.py 
Log Message:
Renamed getPgysicalPathString() to getPath().

Got rid of getPhysicalPath() (which used to return a tuple) by replacing it
by getPath().


=== Zope3/src/zope/app/traversing/__init__.py 1.10 => 1.11 ===
--- Zope3/src/zope/app/traversing/__init__.py:1.10	Wed Mar 19 12:55:37 2003
+++ Zope3/src/zope/app/traversing/__init__.py	Wed Mar 19 14:57:33 2003
@@ -21,21 +21,15 @@
 from types import StringTypes
 
 __all__ = ['traverse', 'traverseName', 'objectName', 'getParent',
-           'getParents', 'getPhysicalPath', 'getPhysicalPathString',
-           'getRoot', 'locationAsTuple', 'locationAsUnicode']
+           'getParents', 'getPath', 'getRoot', 'locationAsTuple',
+           'locationAsUnicode']
 
 _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):
+def getPath(obj):
     """Returns a string representing the physical path to the object.
     """
-    path = getAdapter(obj, IPhysicallyLocatable).getPhysicalPath()
-    return locationAsUnicode(path)
+    return getAdapter(obj, IPhysicallyLocatable).getPath()
 
 def getRoot(obj):
     """Returns the root of the traversal for the given object.


=== Zope3/src/zope/app/traversing/adapters.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/traversing/adapters.py:1.3	Wed Mar 19 12:55:37 2003
+++ Zope3/src/zope/app/traversing/adapters.py	Wed Mar 19 14:57:33 2003
@@ -101,7 +101,7 @@
             raise TypeError("Not enough context to determine location root")
         return getAdapter(container, IPhysicallyLocatable).getRoot()
 
-    def getPhysicalPath(self):
+    def getPath(self):
         "See IPhysicallyLocatable"
         context = self.context
         container = getWrapperContainer(context)
@@ -110,13 +110,16 @@
         name = getInnerWrapperData(context)['name']
 
         container = getAdapter(container, IPhysicallyLocatable)
-        container_path = container.getPhysicalPath()
+        container_path = container.getPath()
 
         if name == '.':
             # skip
             return container_path
 
-        return container_path + (name, )
+        if container_path == u'/':
+            return u'/' + name
+        else:
+            return container_path + u'/' + name
 
 class RootPhysicallyLocatable:
     __doc__ = IPhysicallyLocatable.__doc__
@@ -128,9 +131,9 @@
     def __init__(self, context):
         self.context = context
 
-    def getPhysicalPath(self):
+    def getPath(self):
         "See IPhysicallyLocatable"
-        return ('', )
+        return u'/'
 
     def getRoot(self):
         "See IPhysicallyLocatable"