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 import setSite
from zope.publisher.browser import TestRequest
from import zapi
from zope.publisher.interfaces.browser import ISkin, IDefaultSkin
conman = zapi.getUtility(ISkin, name='')
customer = debugger.root()['customer']
winter = customer['winter']
contents = zapi.queryMultiAdapter((winter,

TestRequest(skin=conman)), name='contents.html')


(<class ''>, <class

So then I do a"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
looked up:

(Pdb) pp byname.get(name)
   <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
  <class ''>),
 ((<InterfaceClass br.cms.interfaces.IContentContainer>,
  <class ''>),
 ((<InterfaceClass br.cms.interfaces.IContentFolder>,
   <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>),
  <class ''>)]

The one the I want is the second set in this list, ''.
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
my layer?

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,


> and
maybe this is part of the discussion going on in the
'SimplifySkinning' proposal/thread

I hope not.

> which I should take a closer look at.

Me too.


Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714  
Zope Corporation
Zope3-dev mailing list

Reply via email to