[Checkins] SVN: zope.traversing/trunk/ * Use direct imports from zope.location.

Dan Korostelev nadako at gmail.com
Mon Feb 2 07:05:48 EST 2009


Log message for revision 95959:
  * Use direct imports from zope.location.
  * Remove RootPhysicallyLocatable, because LocationPhysicallyLocatable does the same thing. Keep import location by pointing it to the LocationPhysicallyLocatable.
  * Remove INamespaceHandler definition as it seems to be obsolete and unused for years.

Changed:
  _U  zope.traversing/trunk/
  U   zope.traversing/trunk/CHANGES.txt
  U   zope.traversing/trunk/buildout.cfg
  U   zope.traversing/trunk/setup.py
  D   zope.traversing/trunk/src/zope/traversing/DEPENDENCIES.cfg
  U   zope.traversing/trunk/src/zope/traversing/adapters.py
  U   zope.traversing/trunk/src/zope/traversing/api.py
  U   zope.traversing/trunk/src/zope/traversing/browser/configure.zcml
  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
  U   zope.traversing/trunk/src/zope/traversing/tests/test_conveniencefunctions.py
  U   zope.traversing/trunk/src/zope/traversing/tests/test_physicallocationadapters.py
  U   zope.traversing/trunk/src/zope/traversing/tests/test_skin.py
  U   zope.traversing/trunk/src/zope/traversing/tests/test_traverser.py

-=-

Property changes on: zope.traversing/trunk
___________________________________________________________________
Modified: svn:ignore
   - bin
build
dist
lib
develop-eggs
eggs
parts
.installed.cfg

   + bin
build
dist
lib
develop-eggs
eggs
parts
.installed.cfg
coverage


Modified: zope.traversing/trunk/CHANGES.txt
===================================================================
--- zope.traversing/trunk/CHANGES.txt	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/CHANGES.txt	2009-02-02 12:05:48 UTC (rev 95959)
@@ -5,8 +5,19 @@
 3.5.1 (unreleased)
 ------------------
 
-- ...
+- The ``RootPhysicallyLocatable`` adapter has been superseded by the
+  refactored ``zope.location.traversing.LocationPhysicallyLocatable``
+  that we depend on since 3.5.0a4.
+  Remove the adapter and its registration, and making its import place
+  pointing to ``zope.location.traversing.LocationPhysicallyLocatable``
+  to maintain backward-compatibility.
 
+- Use direct imports instead of compatibility ones for things that were
+  moved to ``zope.location``.
+
+- Remove the ``zope.traversing.interfaces.INamespaceHandler`` interface,
+  as it seems not to be used for years.
+
 3.5.0 (2009-01-31)
 ------------------
 

Modified: zope.traversing/trunk/buildout.cfg
===================================================================
--- zope.traversing/trunk/buildout.cfg	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/buildout.cfg	2009-02-02 12:05:48 UTC (rev 95959)
@@ -1,7 +1,18 @@
 [buildout]
-develop = .
-parts = test
+develop = . ../zope.location
+parts = test coverage-test coverage-report
 
 [test]
 recipe = zc.recipe.testrunner
 eggs = zope.traversing [test]
+
+[coverage-test]
+recipe = zc.recipe.testrunner
+eggs = zope.traversing [test]
+defaults = ['--coverage', '../../coverage']
+
+[coverage-report]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
+scripts = coverage=coverage-report
+arguments = ('coverage', 'coverage/report')

Modified: zope.traversing/trunk/setup.py
===================================================================
--- zope.traversing/trunk/setup.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/setup.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -53,7 +53,7 @@
                         'zope.proxy',
                         'zope.publisher',
                         'zope.security',
-                        'zope.location>=3.5dev',
+                        'zope.location>=3.5.1',
                         ],
       include_package_data = True,
       zip_safe = False,

Deleted: zope.traversing/trunk/src/zope/traversing/DEPENDENCIES.cfg
===================================================================
--- zope.traversing/trunk/src/zope/traversing/DEPENDENCIES.cfg	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/DEPENDENCIES.cfg	2009-02-02 12:05:48 UTC (rev 95959)
@@ -1,14 +0,0 @@
-# zope.annotation only for testing
-zope.annotation
-# TODO: minimize zope.app
-zope.app
-zope.component
-zope.i18n
-zope.i18nmessageid
-zope.interface
-# zope.location only for testing
-zope.location
-zope.testing
-zope.proxy
-zope.publisher
-zope.security

Modified: zope.traversing/trunk/src/zope/traversing/adapters.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/adapters.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/adapters.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -20,15 +20,18 @@
 import zope.interface
 import zope.component
 
-from zope.traversing.interfaces import TraversalError
-from zope.traversing.interfaces import IPhysicallyLocatable
-from zope.traversing.interfaces import IContainmentRoot
-from zope.traversing.interfaces import ITraverser, ITraversable
+from zope.location.interfaces \
+    import ILocationInfo, LocationError, ITraverser
+from zope.traversing.interfaces import ITraversable
 
 from zope.traversing.namespace import namespaceLookup
 from zope.traversing.namespace import UnexpectedParameters
 from zope.traversing.namespace import nsParse
 
+# BBB: LocationPhysicallyLocatable does the same thing for root object
+# as the RootPhysicallyLocatable that used to be defined here.
+from zope.location.traversing import LocationPhysicallyLocatable as RootPhysicallyLocatable
+
 _marker = object()  # opaque marker that doesn't get security proxied
 
 class DefaultTraversable(object):
@@ -49,34 +52,8 @@
                 return subject[name]
             except (KeyError, TypeError):
                 pass
-        raise TraversalError(subject, name)
+        raise LocationError(subject, name)
 
-class RootPhysicallyLocatable(object):
-    __doc__ = IPhysicallyLocatable.__doc__
-
-    zope.component.adapts(IContainmentRoot)
-    zope.interface.implements(IPhysicallyLocatable)
-
-    def __init__(self, context):
-        self.context = context
-
-    def getPath(self):
-        "See IPhysicallyLocatable"
-        return u'/'
-
-    def getRoot(self):
-        "See IPhysicallyLocatable"
-        return self.context
-
-    def getName(self):
-        "See IPhysicallyLocatable"
-        return u''
-
-    def getNearestSite(self):
-        "See IPhysicallyLocatable"
-        return self.context
-
-
 class Traverser(object):
     """Provide traverse features"""
 
@@ -106,14 +83,14 @@
         if not path[-1]:
             # Start at the root
             pop()
-            curr = IPhysicallyLocatable(self.context).getRoot()
+            curr = ILocationInfo(self.context).getRoot()
         try:
             while path:
                 name = pop()
                 curr = traversePathElement(curr, name, path, request=request)
 
             return curr
-        except TraversalError:
+        except LocationError:
             if default == _marker:
                 raise
             return default
@@ -136,7 +113,7 @@
     'request' is passed in when traversing from presentation code. This
     allows paths like @@foo to work.
 
-    Raises TraversalError if path cannot be found and 'default' was
+    Raises LocationError if path cannot be found and 'default' was
     not provided.
 
     """
@@ -158,11 +135,11 @@
     if traversable is None:
         traversable = ITraversable(obj, None)
         if traversable is None:
-            raise TraversalError('No traversable adapter found', obj)
+            raise LocationError('No traversable adapter found', obj)
 
     try:
         return traversable.traverse(nm, further_path)
-    except TraversalError:
+    except LocationError:
         if default is not _marker:
             return default
         else:

Modified: zope.traversing/trunk/src/zope/traversing/api.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/api.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/api.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -16,9 +16,9 @@
 $Id$
 """
 from zope.interface import moduleProvides
-from zope.traversing.interfaces import IContainmentRoot, ITraversalAPI
-from zope.traversing.interfaces import ITraverser, IPhysicallyLocatable
-from zope.traversing.interfaces import TraversalError
+from zope.location.interfaces \
+    import ILocationInfo, IRoot, LocationError, ITraverser
+from zope.traversing.interfaces import ITraversalAPI
 
 moduleProvides(ITraversalAPI)
 __all__ = tuple(ITraversalAPI)
@@ -59,12 +59,12 @@
 def getPath(obj):
     """Returns a string representing the physical path to the object.
     """
-    return IPhysicallyLocatable(obj).getPath()
+    return ILocationInfo(obj).getPath()
 
 def getRoot(obj):
     """Returns the root of the traversal for the given object.
     """
-    return IPhysicallyLocatable(obj).getRoot()
+    return ILocationInfo(obj).getRoot()
 
 def traverse(object, path, default=_marker, request=None):
     """Traverse 'path' relative to the given object.
@@ -74,7 +74,7 @@
     'request' is passed in when traversing from presentation code. This
     allows paths like @@foo to work.
 
-    Raises TraversalError if path cannot be found
+    Raises LocationError if path cannot be found
 
     Note: calling traverse with a path argument taken from an untrusted
           source, such as an HTTP request form variable, is a bad idea.
@@ -101,7 +101,7 @@
     'request' is passed in when traversing from presentation code. This
     allows paths like @@foo to work.
 
-    Raises TraversalError if path cannot be found and 'default' was
+    Raises LocationError if path cannot be found and 'default' was
     not provided.
 
     """
@@ -120,7 +120,7 @@
 def getName(obj):
     """Get the name an object was traversed via
     """
-    return IPhysicallyLocatable(obj).getName()
+    return ILocationInfo(obj).getName()
 
 def getParent(obj):
     """Returns the container the object was traversed via.
@@ -130,7 +130,7 @@
     parent.
     """
     
-    if IContainmentRoot.providedBy(obj):
+    if IRoot.providedBy(obj):
         return None
     
     parent = getattr(obj, '__parent__', None)
@@ -148,7 +148,7 @@
     Raises a TypeError if the context doesn't go all the way down to
     a containment root.
     """
-    return IPhysicallyLocatable(obj).getParents()
+    return ILocationInfo(obj).getParents()
 
 
 def _normalizePath(path):

Modified: zope.traversing/trunk/src/zope/traversing/browser/configure.zcml
===================================================================
--- zope.traversing/trunk/src/zope/traversing/browser/configure.zcml	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/browser/configure.zcml	2009-02-02 12:05:48 UTC (rev 95959)
@@ -20,7 +20,7 @@
       />
 
   <view
-      for="zope.traversing.interfaces.IContainmentRoot"
+      for="zope.location.interfaces.IRoot"
       name="absolute_url"
       factory=".SiteAbsoluteURL"
       type="zope.publisher.interfaces.http.IHTTPRequest"
@@ -29,7 +29,7 @@
       />
       
   <view
-      for="zope.traversing.interfaces.IContainmentRoot"
+      for="zope.location.interfaces.IRoot"
       factory=".SiteAbsoluteURL"
       type="zope.publisher.interfaces.http.IHTTPRequest"
       permission="zope.Public"
@@ -45,7 +45,7 @@
       />
 
   <browser:page
-      for="zope.traversing.interfaces.IContainmentRoot"
+      for="zope.location.interfaces.IRoot"
       name="absolute_url"
       class=".SiteAbsoluteURL"
       permission="zope.Public"

Modified: zope.traversing/trunk/src/zope/traversing/configure.zcml
===================================================================
--- zope.traversing/trunk/src/zope/traversing/configure.zcml	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/configure.zcml	2009-02-02 12:05:48 UTC (rev 95959)
@@ -4,15 +4,13 @@
 <adapter
     for="*"
     factory="zope.traversing.adapters.Traverser"
-    provides="zope.traversing.interfaces.ITraverser" />
+    provides="zope.location.interfaces.ITraverser" />
 
 <adapter
     for="*"
     factory="zope.traversing.adapters.DefaultTraversable"
     provides="zope.traversing.interfaces.ITraversable" />
 
-<adapter factory="zope.traversing.adapters.RootPhysicallyLocatable" />
-
 <adapter
     name="etc"
     provides="zope.traversing.interfaces.ITraversable" for="*"

Modified: zope.traversing/trunk/src/zope/traversing/interfaces.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/interfaces.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/interfaces.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -25,24 +25,6 @@
 from zope.location.interfaces import ITraverser
 
 
-#TODO this does not seem to be used anywhere. Remove it? --philiKON
-class INamespaceHandler(Interface):
-
-    def __call__(name, object, request):
-        """Access a name in a namespace
-
-        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.
-
-        It is not the responsibility of the handler to give the return value a
-        location.
-        """
-
-
 class ITraversable(Interface):
     """To traverse an object, this interface must be provided"""
 
@@ -50,7 +32,7 @@
         """Get the next item on the path
 
         Should return the item corresponding to 'name' or raise
-        TraversalError where appropriate.
+        LocationError where appropriate.
 
         'name' is an ASCII string or Unicode object.
 
@@ -97,7 +79,7 @@
         'request' is passed in when traversing from presentation code. This
         allows paths like @@foo to work.
 
-        Raises TraversalError if path cannot be found
+        Raises LocationError if path cannot be found
 
         Note: calling traverse with a path argument taken from an untrusted
               source, such as an HTTP request form variable, is a bad idea.
@@ -121,7 +103,7 @@
         'request' is passed in when traversing from presentation code. This
         allows paths like @@foo to work.
 
-        Raises TraversalError if path cannot be found and 'default' was
+        Raises LocationError if path cannot be found and 'default' was
         not provided.
 
         """

Modified: zope.traversing/trunk/src/zope/traversing/namespace.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/namespace.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/namespace.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -24,17 +24,17 @@
 from zope.i18n.interfaces import IModifiableUserPreferredLanguages
 from zope.component.interfaces import ComponentLookupError
 from zope.interface import providedBy, directlyProvides, directlyProvidedBy
+from zope.location.interfaces import IRoot, LocationError
 from zope.publisher.interfaces.browser import IBrowserSkinType
 from zope.publisher.browser import applySkin
 from zope.security.proxy import removeSecurityProxy
 from zope.traversing.interfaces import ITraversable, IPathAdapter
-from zope.traversing.interfaces import TraversalError, IContainmentRoot
 
 
-class UnexpectedParameters(TraversalError):
+class UnexpectedParameters(LocationError):
     "Unexpected namespace parameters were provided."
 
-class ExcessiveDepth(TraversalError):
+class ExcessiveDepth(LocationError):
     "Too many levels of containment. We don't believe them."
 
 def namespaceLookup(ns, name, object, request=None):
@@ -107,7 +107,7 @@
         traverser = zope.component.queryAdapter(object, ITraversable, ns)
 
     if traverser is None:
-        raise TraversalError(object, "++%s++%s" % (ns, name))
+        raise LocationError(object, "++%s++%s" % (ns, name))
 
     return traverser.traverse(name, ())
 
@@ -157,7 +157,7 @@
 def getResource(site, name, request):
     resource = queryResource(site, name, request)
     if resource is None:
-        raise TraversalError(site, name)
+        raise LocationError(site, name)
     return resource
 
 def queryResource(site, name, request, default=None):
@@ -208,7 +208,7 @@
           ...     def traverse(self, name, remaining):
           ...         v = getattr(self, name, None)
           ...         if v is None:
-          ...             raise TraversalError(self, name)
+          ...             raise LocationError(self, name)
           ...         return v
           ...     def __repr__(self):
           ...         return 'splat'
@@ -250,7 +250,7 @@
                     next = traversable.traverse(name, path)
                     if path:
                         continue
-                except TraversalError:
+                except LocationError:
                     pass
 
                 else:
@@ -258,7 +258,7 @@
 
             ob = getattr(ob, '__parent__', None)
             if ob is None:
-                raise TraversalError(self.context, name)
+                raise LocationError(self.context, name)
 
         raise ExcessiveDepth(self.context, name)
 
@@ -308,7 +308,7 @@
         ob = self.context
 
         if (name in ('process', 'ApplicationController')
-            and IContainmentRoot.providedBy(ob)):
+            and IRoot.providedBy(ob)):
             # import the application controller here to avoid circular
             # import problems
             try:
@@ -320,17 +320,17 @@
                 return applicationController
 
         if name not in ('site',):
-            raise TraversalError(ob, name)
+            raise LocationError(ob, name)
 
         method_name = "getSiteManager"
         method = getattr(ob, method_name, None)
         if method is None:
-            raise TraversalError(ob, name)
+            raise LocationError(ob, name)
 
         try:
             return method()
         except ComponentLookupError:
-            raise TraversalError(ob, name)
+            raise LocationError(ob, name)
 
 
 class view(object):
@@ -345,7 +345,7 @@
         view = zope.component.queryMultiAdapter((self.context, self.request),
                                                 name=name)
         if view is None:
-            raise TraversalError(self.context, name)
+            raise LocationError(self.context, name)
 
         return view
 
@@ -371,7 +371,7 @@
         try:
             skin = zope.component.getUtility(IBrowserSkinType, name)
         except ComponentLookupError:
-            raise TraversalError("++skin++%s" % name)
+            raise LocationError("++skin++%s" % name)
         applySkin(self.request, skin)
         return self.context
 
@@ -439,7 +439,7 @@
           2
           >>> try:
           ...     adapter.traverse('bob', ())
-          ... except TraversalError:
+          ... except LocationError:
           ...     print 'no adapter'
           no adapter
 
@@ -451,7 +451,7 @@
         try:
             return zope.component.getAdapter(self.context, IPathAdapter, name)
         except ComponentLookupError:
-            raise TraversalError(self.context, name)
+            raise LocationError(self.context, name)
 
 
 class debug(view):

Modified: zope.traversing/trunk/src/zope/traversing/testing.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/testing.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/testing.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -21,11 +21,10 @@
 import zope.interface
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 from zope.location.traversing import LocationPhysicallyLocatable
-from zope.traversing.interfaces import ITraverser, ITraversable
-from zope.traversing.interfaces import IPhysicallyLocatable
-from zope.traversing.interfaces import IContainmentRoot
+from zope.location.interfaces import ILocationInfo, IRoot, ITraverser
+from zope.traversing.interfaces import ITraversable
 from zope.traversing.adapters import DefaultTraversable
-from zope.traversing.adapters import Traverser, RootPhysicallyLocatable
+from zope.traversing.adapters import Traverser
 from zope.traversing.browser import SiteAbsoluteURL, AbsoluteURL
 from zope.traversing.browser.interfaces import IAbsoluteURL
 from zope.traversing.namespace import etc
@@ -34,20 +33,17 @@
     zope.component.provideAdapter(Traverser, (None,), ITraverser)
     zope.component.provideAdapter(DefaultTraversable, (None,), ITraversable)
     zope.component.provideAdapter(LocationPhysicallyLocatable,
-                                  (None,), IPhysicallyLocatable)
-    zope.component.provideAdapter(RootPhysicallyLocatable,
-                                  (IContainmentRoot,), IPhysicallyLocatable)
+                                  (None,), ILocationInfo)
 
     # set up the 'etc' namespace
     zope.component.provideAdapter(etc, (None,), ITraversable, name="etc")
     zope.component.provideAdapter(etc, (None, None), ITraversable, name="etc")
 
     browserView(None, "absolute_url", AbsoluteURL)
-    browserView(IContainmentRoot, "absolute_url", SiteAbsoluteURL)
+    browserView(IRoot, "absolute_url", SiteAbsoluteURL)
 
     browserView(None, '', AbsoluteURL, providing=IAbsoluteURL)
-    browserView(IContainmentRoot, '', SiteAbsoluteURL,
-                providing=IAbsoluteURL)
+    browserView(IRoot, '', SiteAbsoluteURL, providing=IAbsoluteURL)
 
 
 def browserView(for_, name, factory, providing=zope.interface.Interface):

Modified: zope.traversing/trunk/src/zope/traversing/tests/test_conveniencefunctions.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/tests/test_conveniencefunctions.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/tests/test_conveniencefunctions.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -20,13 +20,12 @@
 import zope.component
 from zope.interface import directlyProvides
 from zope.location.traversing import LocationPhysicallyLocatable
+from zope.location.interfaces \
+    import ILocationInfo, IRoot, LocationError, ITraverser
 from zope.security.proxy import Proxy
 from zope.security.checker import selectChecker
 from zope.traversing.adapters import Traverser, DefaultTraversable
-from zope.traversing.adapters import RootPhysicallyLocatable
-from zope.traversing.interfaces import ITraverser, ITraversable
-from zope.traversing.interfaces import IContainmentRoot, TraversalError
-from zope.traversing.interfaces import IPhysicallyLocatable
+from zope.traversing.interfaces import ITraversable
 
 from zope.app.component.testing import PlacefulSetup
 from zope.container.contained import contained
@@ -47,7 +46,7 @@
         PlacefulSetup.setUp(self)
         # Build up a wrapper chain
         root = C('root')
-        directlyProvides(root, IContainmentRoot)
+        directlyProvides(root, IRoot)
         folder = C('folder')
         item = C('item')
 
@@ -67,9 +66,7 @@
         zope.component.provideAdapter(Traverser, (None,), ITraverser)
         zope.component.provideAdapter(DefaultTraversable, (None,), ITraversable)
         zope.component.provideAdapter(LocationPhysicallyLocatable, (None,),
-                                      IPhysicallyLocatable)
-        zope.component.provideAdapter(RootPhysicallyLocatable,
-                                      (IContainmentRoot,), IPhysicallyLocatable)
+                                      ILocationInfo)
 
     def testTraverse(self):
         from zope.traversing.api import traverse
@@ -106,17 +103,17 @@
     def testTraverseNameBadValue(self):
         from zope.traversing.api import traverseName
         self.assertRaises(
-            TraversalError,
+            LocationError,
             traverseName,
             self.folder, '../root'
             )
         self.assertRaises(
-            TraversalError,
+            LocationError,
             traverseName,
             self.folder, '/root'
             )
         self.assertRaises(
-            TraversalError,
+            LocationError,
             traverseName,
             self.folder, './item'
             )

Modified: zope.traversing/trunk/src/zope/traversing/tests/test_physicallocationadapters.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/tests/test_physicallocationadapters.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/tests/test_physicallocationadapters.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -18,7 +18,7 @@
 from unittest import TestCase, main, makeSuite
 
 import zope.traversing.testing
-from zope.traversing.interfaces import IContainmentRoot, IPhysicallyLocatable
+from zope.location.interfaces import ILocationInfo, IRoot
 from zope.interface import implements
 from zope.testing.cleanup import CleanUp
 
@@ -28,7 +28,7 @@
 
 
 class Root(object):
-    implements(IContainmentRoot)
+    implements(IRoot)
 
     __parent__ = None
 
@@ -47,7 +47,7 @@
         f2 = contained(SiteManagerContainer(), f1, name='f2')
         f3 = contained(C(), f2, name='f3')
         
-        adapter = IPhysicallyLocatable(f3)
+        adapter = ILocationInfo(f3)
 
         self.assertEqual(adapter.getPath(), '/f1/f2/f3')
         self.assertEqual(adapter.getName(), 'f3')

Modified: zope.traversing/trunk/src/zope/traversing/tests/test_skin.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/tests/test_skin.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/tests/test_skin.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -49,11 +49,11 @@
 
     def test_missing_skin(self):
         from zope.traversing.namespace import skin
-        from zope.traversing.interfaces import TraversalError
+        from zope.location.interfaces import LocationError
         request = FauxRequest()
         ob = object()
         traverser = skin(ob, request)
-        self.assertRaises(TraversalError, traverser.traverse, 'bar', ())
+        self.assertRaises(LocationError, traverser.traverse, 'bar', ())
 
 def test_suite():
     return makeSuite(Test)

Modified: zope.traversing/trunk/src/zope/traversing/tests/test_traverser.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/tests/test_traverser.py	2009-02-02 10:59:25 UTC (rev 95958)
+++ zope.traversing/trunk/src/zope/traversing/tests/test_traverser.py	2009-02-02 12:05:48 UTC (rev 95959)
@@ -21,16 +21,15 @@
 from zope.interface import directlyProvides, implementedBy
 from zope.interface.verify import verifyClass
 from zope.location.traversing import LocationPhysicallyLocatable
+from zope.location.interfaces \
+    import ILocationInfo, IRoot, LocationError, ITraverser
 from zope.security.interfaces import Unauthorized
 from zope.security.checker \
     import ProxyFactory, defineChecker, CheckerPublic, Checker
 from zope.security.management import newInteraction, endInteraction
 
 from zope.traversing.adapters import Traverser, DefaultTraversable
-from zope.traversing.adapters import RootPhysicallyLocatable
-from zope.traversing.interfaces import ITraverser, ITraversable
-from zope.traversing.interfaces import IPhysicallyLocatable
-from zope.traversing.interfaces import IContainmentRoot, TraversalError
+from zope.traversing.interfaces import ITraversable
 
 from zope.app.component.testing import PlacefulSetup
 from zope.container.contained import Contained, contained
@@ -65,7 +64,7 @@
 class UnrestrictedNoTraverseTests(unittest.TestCase):
     def setUp(self):
         self.root = root = C('root')
-        directlyProvides(self.root, IContainmentRoot)
+        directlyProvides(self.root, IRoot)
         self.folder = folder = C('folder')
         self.item = item = C('item')
 
@@ -75,7 +74,7 @@
         self.tr = Traverser(root)
 
     def testNoTraversable(self):
-        self.assertRaises(TraversalError, self.tr.traverse,
+        self.assertRaises(LocationError, self.tr.traverse,
                           'folder')
 
 class UnrestrictedTraverseTests(PlacefulSetup, unittest.TestCase):
@@ -84,13 +83,11 @@
 
         zope.component.provideAdapter(DefaultTraversable, (None,), ITraversable)
         zope.component.provideAdapter(LocationPhysicallyLocatable, (None,),
-                                      IPhysicallyLocatable)
-        zope.component.provideAdapter(RootPhysicallyLocatable,
-                                      (IContainmentRoot,), IPhysicallyLocatable)
+                                      ILocationInfo)
 
         # Build up a wrapper chain
         self.root = root = C('root')
-        directlyProvides(self.root, IContainmentRoot)
+        directlyProvides(self.root, IRoot)
         self.folder = folder = contained(C('folder'), root, 'folder')
         self.item = item = contained(C('item'), folder, 'item')
 
@@ -135,7 +132,7 @@
             'notFound')
 
     def testNotFoundNoDefault(self):
-        self.assertRaises(TraversalError, self.tr.traverse, 'foo')
+        self.assertRaises(LocationError, self.tr.traverse, 'foo')
 
     def testTraverseOldStyleClass(self):
         class AnOldStyleClass:
@@ -162,7 +159,7 @@
         adict = {'foo': 'bar'}
         tr = Traverser(adict)
         # This used to raise type error before
-        self.assertRaises(TraversalError, tr.traverse, 'foo/baz')
+        self.assertRaises(LocationError, tr.traverse, 'foo/baz')
 
 
 class RestrictedTraverseTests(PlacefulSetup, unittest.TestCase):
@@ -174,12 +171,10 @@
 
         zope.component.provideAdapter(DefaultTraversable, (None,), ITraversable)
         zope.component.provideAdapter(LocationPhysicallyLocatable, (None,),
-                                      IPhysicallyLocatable)
-        zope.component.provideAdapter(RootPhysicallyLocatable,
-                                      (IContainmentRoot,), IPhysicallyLocatable)
+                                      ILocationInfo)
 
         self.root = root = C('root')
-        directlyProvides(root, IContainmentRoot)
+        directlyProvides(root, IRoot)
         self.folder = folder = contained(C('folder'), root, 'folder')
         self.item = item = contained(C('item'), folder, 'item')
 
@@ -247,7 +242,7 @@
     def testNotFound(self):
         df = DefaultTraversable(C('dummy'))
 
-        self.assertRaises(TraversalError, df.traverse, 'bar', [])
+        self.assertRaises(LocationError, df.traverse, 'bar', [])
 
 def test_suite():
     loader = unittest.TestLoader()



More information about the Checkins mailing list