Shane Hathaway wrote:
Here's the logic: ExternalMethod sets up func_* attributes so it can masquerade as a function. The trick works well enough to convince ZPublisher's mapply() to pass in a "self" argument as the first argument when needed.
What 'self' does mapply pass? I always though it would be the object being rendered (the one that would appear before PARENTS[0] in PARENTS if such a thing were possible ;-) but it appears to in fact be PARENTS[0]. ...which seems silly So, apparently I have to pass this() to my external method to find out what object I'm working on, which is a shame :( My code which prepares a list of object that are in the URL path (does this mean the objects that have been traveresed?) now looks like: def navTree(self,startlevel,this): # strip off acquisition wrappers, reverse the list... yum yum ;-) objects = map(lambda o : getattr(o, 'aq_base', o),self.REQUEST.PARENTS[:-startlevel]) objects.reverse() objects.append(getattr(this, 'aq_base', this)) ...which doesn't give quite what I want objects[-1] should be the object getting rendered, however, for folders getting rendered where index_html is a DTML document, it is the index_html document. I guess what I'm asking is, from PARENTS and this(), is there any way I can tell when I'm rendering folder/ as opposed to folder/index_html? If I can't, then how should I do this? cheers, Chris