[Zope3-checkins] CVS: Zope3/src/zope/app - location.py:1.1.2.3
Fred L. Drake, Jr.
fred at zope.com
Tue Sep 9 16:45:03 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app
In directory cvs.zope.org:/tmp/cvs-serv21201
Modified Files:
Tag: parentgeddon-branch
location.py
Log Message:
normalize whitespace
=== Zope3/src/zope/app/location.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/app/location.py:1.1.2.2 Tue Sep 9 14:08:17 2003
+++ Zope3/src/zope/app/location.py Tue Sep 9 15:45:02 2003
@@ -64,7 +64,7 @@
>>> o1 = Location(); o1.__parent__ = root
>>> LocationPhysicallyLocatable(o1).getRoot() is root
1
-
+
>>> o2 = Location(); o2.__parent__ = o1
>>> LocationPhysicallyLocatable(o2).getRoot() is root
1
@@ -77,7 +77,7 @@
Traceback (most recent call last):
...
TypeError: Not enough context to determine location root
- >>> LocationPhysicallyLocatable(o2).getRoot()
+ >>> LocationPhysicallyLocatable(o2).getRoot()
Traceback (most recent call last):
...
TypeError: Not enough context to determine location root
@@ -104,10 +104,10 @@
"probably due to a a location cycle.")
raise TypeError("Not enough context to determine location root")
-
+
def getPath(self):
"""Get the path of a location.
-
+
See IPhysicallyLocatable
This is an "absolute path", rooted at a root object.
@@ -133,7 +133,7 @@
...
TypeError: Not enough context to determine location root
- >>> LocationPhysicallyLocatable(o2).getPath()
+ >>> LocationPhysicallyLocatable(o2).getPath()
Traceback (most recent call last):
...
TypeError: Not enough context to determine location root
@@ -146,9 +146,9 @@
...
TypeError: Maximim location depth exceeded, """ \
"""probably due to a a location cycle.
-
+
"""
-
+
path = []
context = self.context
max = 9999
@@ -175,12 +175,12 @@
See IPhysicallyLocatable.
>>> o1 = Location(); o1.__name__ = 'o1'
- >>> LocationPhysicallyLocatable(o1).getName()
+ >>> LocationPhysicallyLocatable(o1).getName()
'o1'
-
+
"""
return self.context.__name__
-
+
@@ -202,13 +202,13 @@
1
>>> inside(o4, o1)
1
-
+
>>> inside(o1, o4)
0
>>> inside(o1, None)
0
-
+
"""
while l1 is not None:
@@ -217,8 +217,8 @@
l1 = l1.__parent__
return False
-
-
+
+
def locationCopy(loc):
"""Return a copy of an object,, and anything in it
@@ -258,8 +258,8 @@
1
>>> c3.o4 is o1.o2.o4
1
-
-
+
+
"""
tmp = tempfile.TemporaryFile()
persistent = CopyPersistent(loc)
@@ -298,7 +298,7 @@
But, if we get a location outside the original location, we assign
it an id and return the id:
-
+
>>> o3 = Location()
>>> id3 = persistent.id(o3)
>>> id3 is None
@@ -319,7 +319,7 @@
1
"""
-
+
def __init__(self, location):
self.location = location
self.others = {}
@@ -363,7 +363,7 @@
>>> o1 = Location()
>>> persistent = PathPersistent(o1)
-
+
We provide an id function that returns None when given a non-location:
>>> persistent.id(42)
@@ -388,7 +388,7 @@
>>> o4.__parent__ = o3; o3.o4 = o4
>>> persistent.id(o4)
u'/o3/o4'
-
+
We also provide a load function that returns objects by traversing
given paths. It has to find the root based on the object given to
@@ -401,7 +401,7 @@
1
"""
-
+
def __init__(self, location):
self.location = location
More information about the Zope3-Checkins
mailing list