Jeff Shell wrote:
Going through a lot of debugging, it looks as through it has to do
with how things are ranked in
zope.interface.adapter.AdapterLookup.lookup() for multi-adapters.
I haven't stepped through it in the debugger in Zope 3.1 yet, but I just
got finished doing it in Zope 3.2 and these are my results:
from zope.app.component.hooks import setSite
from zope.publisher.browser import TestRequest
from zope.app import zapi
from zope.publisher.interfaces.browser import ISkin, IDefaultSkin
conman = zapi.getUtility(ISkin, name='br.cms.skin.ContentManagement')
customer = debugger.root()['customer']
winter = customer['winter']
contents = zapi.queryMultiAdapter((winter,
(<class 'zope.app.container.browser.contents.Contents'>, <class
So then I do a pdb.run("zapi.queryMultiAdapter((winter,
TestRequest(skin=conman)), name='contents.html')") and it's inside
AdapterLookup that I get the following. When all of the adapters for
this container and the request with the name 'contents.html' are
(Pdb) pp byname.get(name)
The one the I want is the second set in this list, 'br.cms.skin.CMS'.
Unfortunately, that's the one that loses out in the ranking algorithm
that ranks based on interface's ranking in the spec resolution order.
(NOTE: The IContentContainer there is different than the Zope
IContentContainer! This has cause some confusion in house)
The first one (IFolder, IDefaultBrowserLayer) produces the rank: (4, 4)
The second one, which I want, (IContentContainer, CMS) produces the rank (12, 2)
The third one, which I'm suspecting is generated from a zcml
containerViews directive, wins with the rank (3, 4).
It wins because the 'best' tuple is kept around. A rank wins 'best' by
being less than the current 'best', and (3, 4) is less than all of
I understand why this is happening, but it's (obviously) not what I
want to have happen. I want MY skin layer's declaration of
'contents.html' to win out. It actually works for all container types,
so maybe I need to declare it for a root Zope container interface for
I don't know enough about the relationshipd between your content
interfaces, to comment directly, but I will note that the intent
was that content interface would have precedence over skin. This
was not the case before due to a bug in multi-adapter lookup.
I've been living under the impression that the layer a view was
assigned to had higher precedence than may have been intended,
maybe this is part of the discussion going on in the
I hope not.
> which I should take a closer look at.
Jim Fulton mailto:[EMAIL PROTECTED] Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
Zope3-dev mailing list