summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lotze <tl@gocept.com>2009-09-23 17:48:54 +0000
committerThomas Lotze <tl@gocept.com>2009-09-23 17:48:54 +0000
commit406cb52e68a74aea04de8853612243bbe2d12e09 (patch)
treeabc75ac6129c4e033a87b2dc9bd3d87dc1312d1b /src
parent230dc7aef19d1a8c55a9de08309e3bdc43cafe32 (diff)
downloadzope-traversing-406cb52e68a74aea04de8853612243bbe2d12e09.tar.gz
backed out changes concerning the getParent cleanup which got its feature branch
Diffstat (limited to 'src')
-rw-r--r--src/zope/traversing/api.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/zope/traversing/api.py b/src/zope/traversing/api.py
index 69a166e..2b09363 100644
--- a/src/zope/traversing/api.py
+++ b/src/zope/traversing/api.py
@@ -129,7 +129,16 @@ def getParent(obj):
Raises TypeError if the object doesn't have enough context to get the
parent.
"""
- return ILocationInfo(obj).getParent()
+
+ if IRoot.providedBy(obj):
+ return None
+
+ parent = getattr(obj, '__parent__', None)
+ if parent is not None:
+ return parent
+
+ raise TypeError("Not enough context information to get parent", obj)
+
def getParents(obj):