[Zope-dev] Why does restrictedTraverse() in Zope 2 not respect IPublishTraverse adapters?
Martin Aspeli
optilude+lists at gmail.com
Thu May 14 11:14:55 EDT 2009
Hi,
There's currently a funny inconsistency in Zope's Traversable class. If
you have a URL like http://localhost:8080/path/to/@@aview/foo, and
@@aview implements IPublishTraverse (and, I presume, if there's a custom
IPublishTraverse adapter for any other path component), URL traversal
will work fine, but calling to.restrictedTraverse('@@aview/foo') or some
variant thereof will fail, because (un)restrictedTraverse() does not
respect custom IPublishTraverse adapters.
I can kind of see why it's done like this since it's called
I*Publish*Traverse, but it is a pain.
Note that namespace traversal (like ++skin++) works fine with
restrictedTraverse().
I don't think it'd be hard to implement this, but:
- is this a bug?
- is there a reason not to do this?
Martin
--
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
More information about the Zope-Dev
mailing list