[Zope-dev] External Method Missery

Chris Withers chrisw@nipltd.com
Thu, 13 Jul 2000 11:02:52 +0100


Chris Withers wrote:
> ...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.

Well, I think I solved it for now, but this is horrible! ;(

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()

    # unless we're rendering a folder, add this() to objects
    if not self.REQUEST['URL'][-10:]=='index_html':
        objects.append(getattr(this, 'aq_base', this))

Someone please give me something mroe elegeant ;-)

cheers,

Chris