[Zope] External Method 3

Rik Hoekstra rik.hoekstra@inghist.nl
Thu, 30 Mar 2000 15:48:04 +0200


-----Original Message-----
From: Tom Deprez <tom.deprez@uz.kuleuven.ac.be>
To: Rik Hoekstra <rik.hoekstra@inghist.nl>
Date: donderdag 30 maart 2000 13:46
Subject: Re: [Zope] External Method 3


>Thanks Rik,
>
>However, I think this solution is some sort of the same 'patch' I use. i.e.
>It isn't error-less. I find it strange that there is not a way to know if
>an object has got parents or not. There should be a way.


Sorry, Tom,

I was blabbering last time about hasattr. The right solution is of course:

def recursiveMethod(self, obj, result):
     if hasattr(obj, aq_parent):
            result.append(obj.title)
            recursiveMethod(self, obj.aq_parent, result)
     return result


which you will have to call like this (assuming you external method in Zope
is called recursiveMethod):

<dtml-var "recursiveMethod(<obj>, [])">

Working with a keyword argument didn't work for me. I'm sure someone can
explain you why (but I don't have time for sorting that out right now)

>
>PS. I believe you once wrote that people ask you to write a book on zope.
>Is there a possible way to know which publisher asked you? I received also
>a request last week, but I don't even think on starting (don't know even if
>I will do it anyway) when the same publisher asked you it already.
>


Nope, no such requests on my part. I think you may be confusing me with
Martijn Faassen (?)

Rik