[Zope3-dev] RFC - Partial Adapters

Jim Fulton jim at zope.com
Tue Dec 23 10:08:45 EST 2003


Steve Alexander wrote:
> 
>> Comments are, as always, welcome.
> 
> 
> I expect this will work sensibly with interfaces that extend other 
> interfaces.
> 
> So, let's say I have IContainer and IFishContainer. IFishContainer 
> extends IContainer.
> 
> I register an ISublocations adapter C for IContainer, and I register a 
> different ISublocations adapter F for IFishContainer.
> 
> Let's say I have a FishBowl object fb that provides IFishContainer. I 
> expect that getPartialAdapter(fb, ISublocations, '') will return an 
> iterable that looks like [instance_of_F] when listed.

Hm, I was thinking [instance_of_F, instance_of_C], not necessarily
in that order.  I don't have a strong opinion, one way or the other.

> Even if FishBowl provides IContainer explicitly, as well as by 
> implication from IFishContainer, I would still get [instance_of_F].
>
> 
> Now, let's say I make my FishBowl object fb also provide ISiteManager. 
> There is an adapter S from ISiteManager to ISublocations. Now, 
> getPartialAdapter(fb, ISublocations, '') will return an iterable that 
> looks like [instance_of_F, instance_of_S] when listed.

Right, except see above.

> On a separate issue, would these "partial adapters" make the ordering of 
> interface declarations unimportant?

It would certainly be unimportant for partial adapters, however,
I see partial adapter uses as being relatively limited. <shrug>.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Zope3-dev mailing list