[Zope-dev] Specialists and __bobo_traverse__

Phillip J. Eby pje@telecommunity.com
Wed, 17 Jan 2001 09:53:29 -0500


At 04:41 PM 1/17/01 +0200, Roch'e Compaan wrote:
>
>
>> I don't have the slightest idea what you're trying to accomplish here - I
>> probably missed the beginning of this thread.  Do you want to change the
>> way the specialist processes the string "dataskin1", or the way dataskin1
>> processes the URL component that comes next?  Each requires a different
>> approach.
>
>I want to process the way dataskin1 processes the URL component that comes
>next.  Just to make sure I communicate some sense :)
>

Okay, then your SkinScript *should* work, so long as your dataskins don't
already inherit a __bobo_traverse__ method.  If your DataSkin inherits from
ObjectManager or any of its derivatives, for example, then it won't work.
Of course, the bobo_traverse you're supplying has to be able to be bound to
the DataSkin.  Not all types of Zope "method" objects can do this binding
correctly.  ZPublisher will call the method with two arguments, but your
method will (presumably) need three: one of which is "self" - the DataSkin
itself.  I'm pretty sure DTML methods *won't* work.  "Python Methods"
might.  I don't know about external methods, python scripts, etc.

If I was trying to solve your problem, I would just write a
__bobo_traverse__ in a Python base for my class.  If I needed it to be
replaceable on the fly, I'd write it so that it looked for another
attribute, maybe __skin_traverse__, and called it if it existed.  But I'd
have it pass three parameters, including self, so that I could use almost
any kind of Zope method and make it work.  Then if I needed to customize it
I could use SkinScript or a Class Extender to add the method in.