[Zope3-checkins] CVS: Zope3/src/zope/app - location.py:1.1.2.7

Fred L. Drake, Jr. fred at zope.com
Fri Sep 12 11:38:29 EDT 2003


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

Modified Files:
      Tag: parentgeddon-branch
	location.py 
Log Message:
move the TLocation class definition out of the docstring so it can be
reused for tests in modules that depend on zope.app.location


=== Zope3/src/zope/app/location.py 1.1.2.6 => 1.1.2.7 ===
--- Zope3/src/zope/app/location.py:1.1.2.6	Thu Sep 11 06:31:30 2003
+++ Zope3/src/zope/app/location.py	Fri Sep 12 11:38:28 2003
@@ -370,15 +370,8 @@
     be stored for later use, unlike the ids used by CopyPersistent.
 
     We require outside locations that can be adapted to ITraversable.
-    To simplify the example, we'll make an traversable location:
-
-    >>> class TLocation(Location):
-    ...     zope.interface.implements(ITraverser)
-    ...     def traverse(self, path, default=None, request=None):
-    ...         o = self
-    ...         for name in path.split(u'/'):
-    ...            o = getattr(o, name)
-    ...         return o
+    To simplify the example, we'll use a simple traversable location
+    defined in zope.app.location, TLocation.
 
     Normally, general adapters are used to make objects traversable.
 
@@ -440,3 +433,15 @@
             raise ValueError("ZPersistent paths must be absolute", path)
         root = LocationPhysicallyLocatable(self.location).getRoot()
         return zapi.getAdapter(root, ITraverser).traverse(path[1:])
+
+
+class TLocation(Location):
+    """Simple traversable location used in examples."""
+
+    zope.interface.implements(ITraverser)
+
+    def traverse(self, path, default=None, request=None):
+        o = self
+        for name in path.split(u'/'):
+           o = getattr(o, name)
+        return o




More information about the Zope3-Checkins mailing list