Dieter Maurer wrote:
> Philipp von Weitershausen wrote at 2006-6-22 09:03 +0200:
>> Dieter Maurer wrote:
>>> If you are working on it, then you should implement a
>>> means that "__bobo_traverse__" can tell the caller that
>>> it should use the normal default.
>>> In our private Zope version, I have used an exception
>>> ("UseTraversalDefault") for this purpose.
>> I think that __bobo_traverse__ can raise AttributeError currently to
>> indicate that it has failed to look up an attribute and that traversal
>> should try other options. Apart from being a more explicit spelling,
>> what advantage would UseTraversalDefault have?
> First of all, I had expected that you were in favour
> of "explicit is better than implicit" (usually, I am not). In this case,
> you should be happy with a "more explicit spelling" ;-)
Don't get me wrong, I am :).
> I do not know the current code in Zope 2.10, but earlier
> it looked like:
> if hasattr(object,'__bobo_traverse__'):
Btw, I think this should be a gettattr() call here, hasattr eats exceptions.
> except (AttributeError, KeyError):
> if debug_mode:
> return response.debugError(
> "Cannot locate object at: %s" % URL)
> return response.notFoundError(URL)
> With this code, you were only partially right:
Right, I stand corrected. I have no problem with a more explicit
spelling; I didn't even have one in the first place, was just wondering
what advantage UseTraversalDefault would have (see my original inquiry
We just need to be careful about BBB, as Tres pointed out. The whole
__bobo_traverse__ mess makes me wonder whether it's worth to improve at
all. After all, with IPublishTraverse adapters being a first class
citizen now in ZPublisher, we could, well, leave __bobo_traverse__ as it
is, deprecate it and let it rod till eternity?
Zope-Dev maillist - Zope-Dev@zope.org
** No cross posts or HTML encoding! **
(Related lists -