[Zope3-dev] Re: Providing flexible adapters
Steve Alexander
steve@cat-box.net
Tue, 26 Feb 2002 17:57:38 +0000
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.
Can't it just walk up the ContextWrapper of the object, and get the
nearest utility that's willing to provide an IReference ?
That's what I originally proposed.
> That's why I think a utility is more appropriate.
I agree, sort of ;-)
The utility needs to be in the context of the object, not in the context
of the thing that wants a reference of the object.
> This is just an academic discussion, though, and I
> need to work on useful stuff. Thanks for the brain exercise. :-)
I'm glad you're having fun :-)
I actually want a scratch ObjectHub and EventService working very soon,
so this discussion is more practical than academic for me right now.
--
Steve Alexander