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" <[EMAIL PROTECTED]>
To: "Andy McKay" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
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
> >>>>> "Andy" == Andy McKay <[EMAIL PROTECTED]> writes:
> Andy> Really? Ive looked up this and get nothing (an attribute error
> Andy> its not in globals. If that would work that would be great - but
> Andy> certainly doesnt seem to on a standard DTMLDocument / Method.
> Andy> ----- Original Message -----
> Andy> From: "Brett Carter" <[EMAIL PROTECTED]>
> Andy> To: "Andy McKay" <[EMAIL PROTECTED]>
> Andy> Cc: <[EMAIL PROTECTED]>
> 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,
> >> 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
> >> namespace - and one of the handy things that's always around in the
> >> namespace is the 'this' function, which returns the object on the
> >> 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 - [EMAIL PROTECTED]
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope )
Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -