[Zope3-dev] Re: Providing flexible adapters
Shane Hathaway
shane@zope.com
Tue, 26 Feb 2002 12:16:28 -0500
Steve Alexander wrote:
> Shane Hathaway wrote:
>
>>
>> I agree, but I'm not sure that the normal case is an adapter.
>
>
> Sounds like one to me... Here's an object. Give me an appropriate
> IReference.
>
> What could we possibly want to do under the hood that an adapter would
> be incapable of, but a utility would be capable of?
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.
In the end we have ReferenceByAnyPossiblePathOrURL, and we have followed
the course of Zope 2. We should have made it configurable. We should
have been able to make different kinds of references without modifying
existing software.
We could use an URL protocol registry as Phillip suggested, but what
happened to the very simple contract ReferenceByPath had? What about
ReferenceByOID?
You see, I don't think we can yet define all the axes that modify the
choice of reference type. Not even the object itself can adequately
define how to make a reference to itself. Utilities are meant to solve
this class of problem.
Shane