[Checkins] SVN: zope.traversing/trunk/ Moved the implementation of zope.traversing.api.getParent() to
Thomas Lotze
tl at gocept.com
Tue Sep 15 08:58:19 EDT 2009
Log message for revision 104059:
Moved the implementation of zope.traversing.api.getParent() to
zope.location.interfaces.ILocationInfo, analogous to getParents().
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-15 12:55:51 UTC (rev 104058)
+++ zope.traversing/trunk/CHANGES.txt 2009-09-15 12:58:19 UTC (rev 104059)
@@ -5,6 +5,8 @@
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-15 12:55:51 UTC (rev 104058)
+++ zope.traversing/trunk/src/zope/traversing/api.py 2009-09-15 12:58:19 UTC (rev 104059)
@@ -129,18 +129,9 @@
Raises TypeError if the object doesn't have enough context to get the
parent.
"""
-
- if IRoot.providedBy(obj):
- return None
-
- parent = getattr(obj, '__parent__', None)
- if parent is not None:
- return parent
+ return ILocationInfo(obj).getParent()
- 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