See: http://www.zopelabs.com/cookbook/995468614 hth, -Casey On Friday 19 July 2002 08:30 am, Nico de Boer wrote:
Hi all,
I'm working on a product that renders treemenu's for websites. Now I have to get an initlevel as starting point for my menu.
I've tried the following:
def __init__(self, id, title='', initlevel=0): """initialize a new instance of SiteNav""" self.id = id self.title = title self.initlevel = self.getInitLevel()
def getInitLevel(self): """returns the initlevel""" initlevel = 0 parent = self while 1: if hasattr(parent,'aq_parent'): parent=parent.aq_parent initlevel = initlevel + 1 else: break return initlevel - 1
When I add a SiteNav object (folderish object) and I put a DTMLMethod in it where I call getInitLevel, I get the correct initlevel.
But when I ask for initlevel in the DTMLMethod, I get -1.
Doesn't the object has a aq_parent at initialization?
Is there a way to do this?
Thanx!
Greetz Nico