[Zope3-dev] Re: Providing flexible adapters

Jim Fulton jim@zope.com
Tue, 26 Feb 2002 17:19:07 -0500


"Phillip J. Eby" wrote:
> 
> At 10:40 AM 2/26/02 -0500, Shane Hathaway wrote:
> >Zope 3's answer is to make a reference generation utility.  It would be a
> >very, very simple utility that might just look up an adapter.  If we later
> >decide that the adapter registry is sufficient, we can just leave it that
> >way.  If we instead decide that generating a reference depends on not just
> >the interfaces of the object, but also the interfaces of the object's
> >context (or something else), we can make a new service.
> 
> Interesting.  Are utilities placeful?

Everything is play^Hceful.

> I'm not sure that putting the utility in front of the adapter gives any
> advantage for this situation, however.  One could always register an
> adapter that looked up the utility, right?  So if we expect the normal case
> to be just an adapter, it seems more straightforward to use the adapter,
> reducing the number of layers of delegation for the common case.

I agree.

> >Actually, FYI you can already register an adapter that adapts anything,
> >using the value "None" as the object's interface.
> 
> Then maybe there should be an IReferenceable adapter that adapts anything,
> by looking up a placeful utility.  :)  Then we get two for the price of
> one, so to speak.  Ain't ZCA grand?  :)

Yes. ;)

Actually, I'd have the default adapter use the context to construct a 
path-based reference. 

But there is another issue, which I'll get to in a separate message. :)

Jim

--
Jim Fulton           mailto:jim@zope.com       Python Powered!        
CTO                  (888) 344-4332            http://www.python.org  
Zope Corporation     http://www.zope.com       http://www.zope.org