[Zope-PTK] Access "top" object without passing it as argument to
method?
Shane Hathaway
shane@digicool.com
Tue, 27 Feb 2001 17:49:52 -0500
Sigve Tjora wrote:
>
> Hi!
>
> I am developing a tool and want to read some properties from the object
> being read by the browser.
>
> Is there a easy way to do this in python?
>
> If some of my dtml-code functions call
> <dtml-var "portal_mytool.myMethod()">
> then how can myMethod get a reference to the the object on the top (or is
> it named the bottom?) of the aqusition-stack, and then travers the stack
> just as normally would have been done looking for a attribute?
>
> E.g. if a object in http://myserver/portal/folder1/folder2/object
> calls portal_mytool.myMethod(), how can this method travers object,
> folder2, folder1 and portal (in that order) to find an attribute?
>
> thanks in advance!
Are you looking for "this()"? If you added a parameter to the method,
you could call:
<dtml-var "portal_yourtool.yourMethod(this())">
Shane