Finally woke up on this problem. Got this working by simply calling resolve_url upon the request object. But what I want is a result that changes depending upon the object. Let's face it, this can be acheived a whole lot easier by creating a method for the objects and calling that. So thats what Ive done and stayed away from using a dtml-tag. Thanks for your help. ----- Original Message ----- From: "Brett Carter" <brett@kavi.com> To: "Andy McKay" <andym@activestate.com> Cc: <zope-dev@zope.org> Sent: Wednesday, September 13, 2000 9:51 AM Subject: Re: [Zope-dev] Custom dtml tag
Andy - looking up 'this' in a dtml method or document won't work unless you expose it in your python product/tag definition. I'm talking about getting 'this' inside a dtml tag that I have defined myself (i.e. <dtml-foobar></dtml-foobar>). If you want 'this' available in dtml, write an external method and just return 'self' def this(self): return self -Brett
"Andy" == Andy McKay <andym@activestate.com> writes:
Andy> Really? Ive looked up this and get nothing (an attribute error actually) and Andy> its not in globals. If that would work that would be great - but a it Andy> certainly doesnt seem to on a standard DTMLDocument / Method.
Andy> ----- Original Message ----- Andy> From: "Brett Carter" <brett@kavi.com> Andy> To: "Andy McKay" <andym@activestate.com> Andy> Cc: <zope-dev@zope.org> Andy> Sent: Tuesday, September 12, 2000 4:17 PM Andy> Subject: Re: [Zope-dev] Custom dtml tag
>> Andy: here's what I've gleaned - in a dtml tag's render() method, you >> get passed in self and a template dict, in my example let's call it >> 'md'. md is essentially a stack/dictionaryish object of the *current* >> namespace - and one of the handy things that's always around in the >> namespace is the 'this' function, which returns the object on the top >> of the stack. >> >> Just lookup 'this', run it, and there you have a reference to the >> calling object! Ex: >> >> def render(self, md) >> this = md.getitem('this') >> callingObj = this() >> return "Calling object was %s" % (callingObj.id()) >> >> Note I haven't tested this code. Good luck! >> -Brett >>
_______________________________________________ Zope-Dev maillist - Zope-Dev@zope.org http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )