[Zope] acquisition and __bobo_traverse__

Chris Withers chris at simplistix.co.uk
Tue Jan 20 06:36:52 EST 2004


Dylan Reinhardt wrote:

> Hi All,
> 
> I have a situation where I want one object to alias methods that are
> actually provided by a different object.  This is being done in
> __bobo_traverse__ in a Python product that subclasses Folder
> 
> I can call another object's method easily enough, but when I do this, it
> will resolve all names in the context of the *calling* object, not the
> method's physical container. That makes a certain amount of sense,
> perhaps... but it isn't what I *want* to happen.  
> 
> I've tried various combinations like:
> 
> obj.method
> obj.method.__of__(self)
> obj.method.__of__(obj)
> 
> All with no joy... in each case, the method is the correct method but
> names are resolved by the *calling* object, not by the returned method's
> container.  
> 
> Any ideas how to make this work the way I want it to?

try:

aq_base(obj.method).__of__(aq_base(self))

...or some such.

good luck, manaually building acquisition hierarchies is fun...

Chris




More information about the Zope mailing list