[Zope] - Acquisition question

Michel Pelletier mike@icebox.dlogue.net
Wed, 9 Dec 1998 00:43:24 -0600 (CST)


Hello,

This is just a tricky Acquisition question, not a bug, low priority.  I have a
Folderish (I guess the Digifolk call this a Folderoid, but the source code makes
it seem Folderish :) object which is an application wrapper around my own
heirarchy of custom folders and widgets.  In my app wrapper I define a number of
Document objects that are preloaded in my __init__ method.  There are three main
classes, Trove, TroveFolder, and Trove Item.  I have inserted a couple TroveFolder
and TroveItem objects in my example tree below to spice it up a bit, only the
Documents come loaded by default.

Trove
	Index (Document)
	FolderIndex (Document)
	ItemIndex (Document)
	TroveFolder
		TroveFolder2
			TroveItem
		TroveItem2

Now for example, TroveItem2 has an index_html method like this:

def index_html(self, REQUEST):
	if REQUEST is not None:
		return self.ItemIndex(self, REQUEST)

This fails.  I figure it's because I'm not using ItemIndex in the
right context,
and Acquisition cannot the method in the top level folder.  Also, I'm worried that
even if it did the Document would be out of context, thinking it was in the  root
folder instead of two levels down, right??

So I'm thinking I need some kind of mechanism with __of__ and aq_parent to ascend
recursively up tree until it finds an ItemIndex method.  Before I try such a
beast, am I barking up the wrong tree?  Has Acquisition truely escaped me?

Michel