Wichert Akkerman wrote:
Previously Dylan Jay wrote:
I've observed an unexpected effect that you can override a skin based template or python script with a browser view in a sub folder but not at the portal root. I'm trying to get my head round all the various traversal code in zope/five and would appreciate any tips from someone who knows this code well.

For some unknown reason CMF explicitly encoded that behaviour in
__bobo_traverse__. It's bitten Plone as well.

As far as I can tell, it's not actually encoded in __bobo_traverse__ but in the interactions between Skinnable.__getattr__ and OFS.Traversable.

OFS.Traversable.unrestrictedTraverse looks up objects in the following order:

 1. namespaces (@@ and ++)

 2. bobo_traverse

 3. getattr(aq_base(obj), name) # no acquisition


 5. getattr(obj, name) # with acquisition

The difference in behaviour occurs because at the portal root skin objects get picked up at number 3, whereas in other places they get picked up at number 5, after views.

To fix this we need to add a __bobo__traverse__ method to Skinnable that looks up objects in the order:

 1. getattr(aq_base(obj), name), but excluding skin objects


 3. getattr(aq_base(obj), name), including skin objects

 4. getattr(obj, name)


Zope-CMF maillist  -  Zope-CMF@lists.zope.org

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to