equal
deleted
inserted
replaced
30 def getParent(context, interface=Interface, allow_context=True): |
30 def getParent(context, interface=Interface, allow_context=True): |
31 """Get first parent of the given context that implements given interface""" |
31 """Get first parent of the given context that implements given interface""" |
32 if allow_context: |
32 if allow_context: |
33 parent = context |
33 parent = context |
34 else: |
34 else: |
35 parent = zapi.getParent(context) |
35 parent = getattr(context, '__parent__', None) |
36 while parent is not None: |
36 while parent is not None: |
37 if interface.providedBy(parent): |
37 if interface.providedBy(parent): |
38 return interface(parent) |
38 return interface(parent) |
39 parent = zapi.getParent(parent) |
39 parent = getattr(parent, '__parent__', None) |
40 return None |
40 return None |