[Zope] custom __of__

Randall F. Kern randy@spoke.net
Wed, 20 Dec 2000 15:04:48 -0800


This is something that I still don't quite understand.

I have a set of (python, Folder derived) objects, which are children of
a Folder derived python class.  Each of these in turn has another,
related python object.

/
	a
		ab1
		ab2
		ab3
	b1
	b2
	b3

When I access /a/ab1, I want b1 inserted into the acquisition hierarchy
between a and ab1.  I've done this with __bobo_traverse__, but that
doesn't help when you access ab1 as an attribute of a, such as when
using objectValues().  So I thought I would try overriding __of__, like
so in the ab class:

def __of__(self, parent):
	wparent = self._b.__of__(parent)
	return Folder.Folder.__of__(self, wparent)

But that doesn't work, I get this error on the return line:
	Error Type: TypeError
	Error Value: unbound C method must be called with Acquirer 1st
argument


Any ideas?  I'm pretty confused.

Thanks,
-Randy