[Checkins] SVN: zope.traversing/trunk/ Reverse dependencies between zope.location and zope.traversing.

Christian Theune ct at gocept.com
Thu Jan 29 14:42:56 EST 2009


Log message for revision 95522:
  Reverse dependencies between zope.location and zope.traversing.
  

Changed:
  U   zope.traversing/trunk/CHANGES.txt
  U   zope.traversing/trunk/buildout.cfg
  U   zope.traversing/trunk/setup.py
  U   zope.traversing/trunk/src/zope/traversing/api.py
  U   zope.traversing/trunk/src/zope/traversing/browser/absoluteurl.py
  U   zope.traversing/trunk/src/zope/traversing/configure.zcml
  U   zope.traversing/trunk/src/zope/traversing/interfaces.py
  U   zope.traversing/trunk/src/zope/traversing/namespace.py
  U   zope.traversing/trunk/src/zope/traversing/testing.py

-=-
Modified: zope.traversing/trunk/CHANGES.txt
===================================================================
--- zope.traversing/trunk/CHANGES.txt	2009-01-29 19:40:42 UTC (rev 95521)
+++ zope.traversing/trunk/CHANGES.txt	2009-01-29 19:42:56 UTC (rev 95522)
@@ -5,6 +5,8 @@
 3.5.0a4 (2008-08-01)
 --------------------
 
+- Reverse dependencies between zope.location and zope.traversing.
+
 - Updated (test) dependencies and tests to expect and work with a spec
   compliant TAL interpreter as available in zope.tal >= 3.5.0.
 - Fixed deprecation warning caused by using an old module name for

Modified: zope.traversing/trunk/buildout.cfg
===================================================================
--- zope.traversing/trunk/buildout.cfg	2009-01-29 19:40:42 UTC (rev 95521)
+++ zope.traversing/trunk/buildout.cfg	2009-01-29 19:42:56 UTC (rev 95522)
@@ -1,7 +1,6 @@
 [buildout]
-develop = . 
+develop = .
 parts = test
-find-links = http://download.zope.org/distribution/
 
 [test]
 recipe = zc.recipe.testrunner

Modified: zope.traversing/trunk/setup.py
===================================================================
--- zope.traversing/trunk/setup.py	2009-01-29 19:40:42 UTC (rev 95521)
+++ zope.traversing/trunk/setup.py	2009-01-29 19:42:56 UTC (rev 95522)
@@ -22,7 +22,7 @@
                     open('CHANGES.txt').read())
 
 setup(name='zope.traversing',
-      version = '3.5dev',
+      version = '3.5a5dev',
       url='http://pypi.python.org/pypi/zope.traversing',
       license='ZPL 2.1',
       author='Zope Corporation and Contributors',
@@ -50,6 +50,7 @@
                         'zope.proxy',
                         'zope.publisher',
                         'zope.security',
+                        'zope.location>=3.5dev',
                         ],
       include_package_data = True,
       zip_safe = False,

Modified: zope.traversing/trunk/src/zope/traversing/api.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/api.py	2009-01-29 19:40:42 UTC (rev 95521)
+++ zope.traversing/trunk/src/zope/traversing/api.py	2009-01-29 19:42:56 UTC (rev 95522)
@@ -148,24 +148,9 @@
     Raises a TypeError if the context doesn't go all the way down to
     a containment root.
     """
-    if IContainmentRoot.providedBy(obj):
-        return []
+    return IPhysicallyLocatable(obj).getParents()
 
-    
-    parents = []
-    w = obj
-    while 1:
-        w = w.__parent__
-        if w is None:
-            break
-        parents.append(w)
 
-    if parents and IContainmentRoot.providedBy(parents[-1]):
-        return parents
-
-    raise TypeError("Not enough context information to get all parents")
-
-
 def _normalizePath(path):
     """Normalize a path by resolving '.' and '..' path elements."""
 

Modified: zope.traversing/trunk/src/zope/traversing/browser/absoluteurl.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/browser/absoluteurl.py	2009-01-29 19:40:42 UTC (rev 95521)
+++ zope.traversing/trunk/src/zope/traversing/browser/absoluteurl.py	2009-01-29 19:42:56 UTC (rev 95522)
@@ -51,7 +51,7 @@
             or sameProxiedObjects(context, request.getVirtualHostRoot())):
             return request.getApplicationURL()
 
-        context = ILocation(context, context)
+        context = ILocation(context)
         container = getattr(context, '__parent__', None)
         if container is None:
             raise TypeError(_insufficientContext)

Modified: zope.traversing/trunk/src/zope/traversing/configure.zcml
===================================================================
--- zope.traversing/trunk/src/zope/traversing/configure.zcml	2009-01-29 19:40:42 UTC (rev 95521)
+++ zope.traversing/trunk/src/zope/traversing/configure.zcml	2009-01-29 19:42:56 UTC (rev 95522)
@@ -1,5 +1,5 @@
 <configure xmlns="http://namespaces.zope.org/zope"
-    xmlns:zcml="http://namespaces.zope.org/zcml">
+  xmlns:zcml="http://namespaces.zope.org/zcml">
 
 <adapter
     for="*"

Modified: zope.traversing/trunk/src/zope/traversing/interfaces.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/interfaces.py	2009-01-29 19:40:42 UTC (rev 95521)
+++ zope.traversing/trunk/src/zope/traversing/interfaces.py	2009-01-29 19:42:56 UTC (rev 95522)
@@ -15,15 +15,15 @@
 
 $Id$
 """
+
 from zope.interface import Interface
 
-class TraversalError(KeyError, LookupError):
-    """There is no object for the name given to a traversal
-    """
+# BBB: Re-import symbols to their old location.
+from zope.location.interfaces import LocationError as TraversalError
+from zope.location.interfaces import IRoot as IContainmentRoot
+from zope.location.interfaces import ILocationInfo as IPhysicallyLocatable
+from zope.location.interfaces import ITraverser
 
-class IContainmentRoot(Interface):
-    """Marker interface to designate root objects
-    """
 
 #TODO this does not seem to be used anywhere. Remove it? --philiKON
 class INamespaceHandler(Interface):
@@ -33,7 +33,7 @@
 
         The name lookup usually depends on an object and/or a
         request. If an object or request is unavailable, None will be passed.
-    
+
         The parameters provided, are passed as a sequence of
         name, value items.  The 'pname' argument has the original name
         before parameters were removed.
@@ -42,28 +42,7 @@
         location.
         """
 
-class IPhysicallyLocatable(Interface):
-    """Objects that have a physical location in a containment hierarchy.
-    """
 
-    def getRoot():
-        """Return the physical root object
-        """
-
-    def getPath():
-        """Return the physical path to the object as a string.
-        """
-
-    def getName():
-        """Return the last segment of the physical path.
-        """
-
-    def getNearestSite():
-        """Return the site the object is contained in
-        
-        If the object is a site, the object itself is returned.
-        """
-
 class ITraversable(Interface):
     """To traverse an object, this interface must be provided"""
 
@@ -79,28 +58,6 @@
         method is allowed to change the contents of furtherPath.
         """
 
-_RAISE_KEYERROR = object()
-
-class ITraverser(Interface):
-    """Provide traverse features"""
-
-    def traverse(path, default=_RAISE_KEYERROR, request=None):
-        """
-        Return an object given a path.
-
-        Path is either an immutable sequence of strings or a slash ('/')
-        delimited string.
-
-        If the first string in the path sequence is an empty string,
-        or the path begins with a '/', start at the root. Otherwise the path
-        is relative to the current context.
-
-        If the object is not found, return 'default' argument.
-
-        'request' is passed in when traversing from presentation code. This
-        allows paths like @@foo to work.
-        """
-
 class ITraversalAPI(Interface):
     """Common API functions to ease traversal computations
     """

Modified: zope.traversing/trunk/src/zope/traversing/namespace.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/namespace.py	2009-01-29 19:40:42 UTC (rev 95521)
+++ zope.traversing/trunk/src/zope/traversing/namespace.py	2009-01-29 19:42:56 UTC (rev 95522)
@@ -71,7 +71,7 @@
       >>> namespaceLookup('fiz', 'bar', C())    # doctest: +ELLIPSIS
       Traceback (most recent call last):
       ...
-      TraversalError: (<zope.traversing.namespace.C object at 0x...>, '++fiz++bar')
+      LocationError: (<zope.traversing.namespace.C object at 0x...>, '++fiz++bar')
 
     We'll get the same thing if we provide a request:
 
@@ -80,7 +80,7 @@
       >>> namespaceLookup('foo', 'bar', C(), request)    # doctest: +ELLIPSIS
       Traceback (most recent call last):
       ...
-      TraversalError: (<zope.traversing.namespace.C object at 0x...>, '++foo++bar')
+      LocationError: (<zope.traversing.namespace.C object at 0x...>, '++foo++bar')
 
     We need to provide a view:
 
@@ -236,7 +236,7 @@
           >>> adapter.traverse('d', ())
           Traceback (most recent call last):
           ...
-          TraversalError: (splat, 'd')
+          LocationError: (splat, 'd')
         """
         i = 0
         ob = self.context

Modified: zope.traversing/trunk/src/zope/traversing/testing.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/testing.py	2009-01-29 19:40:42 UTC (rev 95521)
+++ zope.traversing/trunk/src/zope/traversing/testing.py	2009-01-29 19:42:56 UTC (rev 95522)
@@ -49,6 +49,7 @@
     browserView(IContainmentRoot, '', SiteAbsoluteURL,
                 providing=IAbsoluteURL)
 
+
 def browserView(for_, name, factory, providing=zope.interface.Interface):
     zope.component.provideAdapter(factory, (for_, IDefaultBrowserLayer),
                                   providing, name=name)



More information about the Checkins mailing list