So, we determined that OFS.Traversable's unrestrictedTraverse() 
shouldn't grow support for IPublishTraverse, which is fair enough. We're 
now using an ITraversable adapter instead (++namespace++).

However, we found another inconsistency. In URL traversal, this works:


In OFS.Traversable, it doesn't, but this does:


The reason is that in restrictedTraverse(), we have this check:

   if name and name[:1] in '@+' and name != '+' and nsParse(name)[1]:
       ns, nm = nsParse(name)

However, nsParse(name)[1] is '' if no name is provided after the namespace.

In BaseRequest.traverseName() we have a similar, but more relaxed check:

   if name and name[:1] in '@+'
       ns, nm = nsParse(name)
       if ns:

This also has the advantage of not calling nsParse() twice.

I can't understand why OFS.Traversable would explicitly disallow 
namespace traversal with an empty string as the name. Is this on 
purpose, or a bug?


Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to