[Zope3-dev] Interface implementation declaration weight (was Re:
View lookup changes in Zope 3.2?)
Gary Poster
gary at zope.com
Wed Dec 14 00:09:21 EST 2005
Jeff, fwiw, to sidestep the problem with your current implementation,
and just try to address some possible solutions, we also replace the
standard contents view, but we do it generally--for the default
layer. There are at least a couple of ways to do that (zcml
overrides and custom folder instances with their own associated
views). Looking that way might get you past what sounds like a
possible time crunch.
That's not to dissuade you from continuing to explore your current
avenue: it's just offered as a possible practical way out, maybe
while you figure out your original approach.
On the other hand, to try to answer what I think was one of your
recent questions, directlyProvided interfaces are more important for
a match than interfaces from a class.
>>> from zope import interface
>>> class IFoo(interface.Interface):
... pass
...
>>> class IBar(IFoo):
... pass
...
>>> class IBaz(interface.Interface):
... pass
...
>>> class Bar(object):
... interface.implements(IBar)
...
>>> bar = Bar()
>>> interface.directlyProvides(bar, IBaz)
>>> interface.providedBy(bar).__iro__
(<InterfaceClass __main__.IBaz>, <InterfaceClass __main__.IBar>,
<InterfaceClass __main__.IFoo>, <InterfaceClass
zope.interface.Interface>)
I believe that's pertinent. :-)
I'm pretty sure there's a proposal on the wiki somewhere with Jim's
full lookup algorithm that you want, but the iro for the pertinent
object(s) usually gets me far enough.
HTH
Gary
More information about the Zope3-dev
mailing list