[Zope] External Method

Tom Deprez tom.deprez@uz.kuleuven.ac.be
Tue, 28 Mar 2000 14:28:43 +0200


I want to make an external method which does the following :

iterates over all the parents, if a parent is of a certain type, the title
must be added to a list. However I don't know how to iterate over an object
(ZClass) it's parents in Python/Zope. Can anybody help?

def GetParentNames(self):
  obj=self
  result=[]
  while obj.parent<>nil:			<-- this is wrong
    obj=obj.parent				<-- this is wrong
    if obj.meta_type=='KBItem':
      result.append(obj.Title)
  return result

Thanks in advance,

Tom.