[Zope-dev] SimpleComponentTraverser flaw
Dan Korostelev
nadako at gmail.com
Wed Sep 24 15:46:28 EDT 2008
I think that topic was raised before, but I can't find any information
about what's going to be done on that :)
The zope.app.publication.traversers.SimpleComponent (that's used by
default for most of objects) in its publishTraverse method uses the
adapter lookup without asking for some specific view interface (like
IBrowserView), like this:
view = queryMultiAdapter((ob, request), name=name)
This causes problems when we have any non-view context/request
adapters registered. One real-life example of that kind of adapter is
ILayoutTemplate adapter registered with z3c:layout directive from
z3c.template package.
So the publisher that looks for views should look them up like this:
view = queryMultiAdapter((ob, request), IBrowserView, name=name)
One issue is that SimpleComponentTraverser also provides
IXMLRPCPublisher and (as far as I understood) should be able to look
up IXMLRPCView adapters. I'm asking about how to fix this without
breaking much backward-compatibility. Should we just write split the
traverser in two (one for IBrowserViews and one for IXMLRPCViews) or
should we look up the view depending on request by using if/then
condition (if IBrowserRequest is provided - lookup IBrowserView, if
IXMLRPCRequest provided - lookup IXMLRPCView). Or probably some other
way? Also, is there any things to note when fixing that issue?
Thanks in advance for any comments on this.
--
WBR, Dan Korostelev
More information about the Zope-Dev
mailing list