[Zope] External Method

Tom Deprez tom.deprez@uz.kuleuven.ac.be
Tue, 28 Mar 2000 16:58:04 +0200


Hi,

Yes, this gives me parents, but it doesn't work for my problem :

The external method is used for storing the information into a ZCatalog.
Now, when the Catalog is updated, I get the wrong parents, I get the
parents of the catalog and not of the object itself. :-(

Somebody another idea?

Tom.

>Tom,
>
>How about something like (untested):
>
>def GetParentNames(self):
>    p=self.REQUEST.PARENTS[:]
>    result=[]
>    for obj in p:
>           if obj.meta_type =='KBItem':
>                result.append(obj.Title)
>    return result
>
>HTH
>
>Phil
>phil.harris@zope.co.uk
>
>
>----- Original Message -----
>From: "Tom Deprez" <tom.deprez@uz.kuleuven.ac.be>
>To: <zope@zope.org>
>Sent: Tuesday, March 28, 2000 1:28 PM
>Subject: [Zope] External Method
>
>
>> 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.
>>
>> _______________________________________________
>> Zope maillist  -  Zope@zope.org
>> http://lists.zope.org/mailman/listinfo/zope
>> **   No cross posts or HTML encoding!  **
>> (Related lists -
>>  http://lists.zope.org/mailman/listinfo/zope-announce
>>  http://lists.zope.org/mailman/listinfo/zope-dev )
>
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists - 
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )
>
>