[Zope3-dev] Re: Providing flexible adapters

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


Shane Hathaway wrote:
> 
> Steve Alexander wrote:
> > Steve Alexander wrote:
> >
> >>
> >> I don't see how a utility helps here. The utility needs to be
> >> "acquired" from the context of the object, not from the context of the
> >> component that wants to get the object's reference.
> >>
> >> Surely an adapter can do that task.
> >
> > Or rather, an adapter's "maker", that is, factory.
> 
> Ok, but then you'd need some kind of special registry so that the
> factory can choose what kind of reference to create based on the place
> of the object.  You would want it to be a managed registry so you can
> configure it.  Services are the right way to create managed registries,
> so you'll need a service.  The adapter factory will essentially defer to
> a service.
> 
> I think the correct choice of reference type depends more on its place
> than the type of the object it points to (except perhaps outside Zope).

This sounds pretty complex to me.  I can't even follow your original
example:

"Let's say we provide a ReferenceByPath adapter for all IFolder objects. 
  This is the normal case in Zope 2.  Then let's say we put a simple 
folder inside a placeful service.  Services can't be looked up by simple 
paths, so I guess we have to augment the contract of ReferenceByPath. 
Then let's say we put a simple folder inside a placeful user object (for 
storing preferences).  Users don't get looked up by simple paths either, 
so again we have to augment the contract of ReferenceByPath.  Then we 
want to refer to a simple folder accessible only via SOAP.  Wow."

Wow indeed. I don't even know what you said. ;)

This feels like complicated architecture to supprt some kind of edge
case.

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