[Checkins] SVN: zope.traversing/trunk/ backed out changes concerning the getParent cleanup which got its feature branch
Thomas Lotze
tl at gocept.com
Wed Sep 23 13:48:55 EDT 2009
Log message for revision 104461:
backed out changes concerning the getParent cleanup which got its feature branch
Changed:
U zope.traversing/trunk/CHANGES.txt
U zope.traversing/trunk/src/zope/traversing/api.py
-=-
Modified: zope.traversing/trunk/CHANGES.txt
===================================================================
--- zope.traversing/trunk/CHANGES.txt 2009-09-23 17:47:44 UTC (rev 104460)
+++ zope.traversing/trunk/CHANGES.txt 2009-09-23 17:48:54 UTC (rev 104461)
@@ -5,8 +5,6 @@
3.7.3 (unreleased)
------------------
-- Moved the implementation of zope.traversing.api.getParent() to
- zope.location.interfaces.ILocationInfo, analogous to getParents().
3.7.2 (2009-08-29)
------------------
Modified: zope.traversing/trunk/src/zope/traversing/api.py
===================================================================
--- zope.traversing/trunk/src/zope/traversing/api.py 2009-09-23 17:47:44 UTC (rev 104460)
+++ zope.traversing/trunk/src/zope/traversing/api.py 2009-09-23 17:48:54 UTC (rev 104461)
@@ -129,9 +129,18 @@
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):
"""Returns a list starting with the given object's parent followed by
each of its parents.
More information about the checkins
mailing list