Get access to __parent__ directly instead of using zapi.getParent() to avoid exceptions
authorThierry Florac <tflorac@ulthar.net>
Mon, 17 Aug 2009 23:52:10 +0200
changeset 14 c5b819c782dd
parent 13 6eddd17108b1
child 15 2c187bbb521f
Get access to __parent__ directly instead of using zapi.getParent() to avoid exceptions
ztfy/utils/traversing.py
--- a/ztfy/utils/traversing.py	Sat Aug 15 00:11:09 2009 +0200
+++ b/ztfy/utils/traversing.py	Mon Aug 17 23:52:10 2009 +0200
@@ -32,9 +32,9 @@
     if allow_context:
         parent = context
     else:
-        parent = zapi.getParent(context)
+        parent = getattr(context, '__parent__', None)
     while parent is not None:
         if interface.providedBy(parent):
             return interface(parent)
-        parent = zapi.getParent(parent)
+        parent = getattr(parent, '__parent__', None)
     return None