Chris Withers wrote at 2006-11-28 18:09 +0000:
>Benji York wrote:
>> Chris Withers wrote:
>>> I don't think it'll be a common pattern, but it doesn't feel right to 
>>> me that a named adapter (ie: one registered with a specific name) has 
>>> no way of finding out what name it has been registered with...
>> Because the same adapter can be registered more than once, it would 
>> actually need to find out all the names with which it was registered.
>Really? Now this is a use case I hadn't thought of.. can you give me 
>some examples of where you've run into this?

An example where an adapter *can* be registered several times
was presented by yourself :-)

    The "str" adapter (factory) can be used to adapt anything
    to a string.

    You may register it several times because you may not
    want to adapt all interfaces with it but only those
    derived of several base interfaces.

    You may or may not use different names as you might
    have different types of string adaptation (e.g. different
    types of string presentations).

The "str" example shows also that it is not sensible
that the adapter registry framework gives the adapter (factory)
a way to determine its name ("str" has nothing where the "name"
could be sticked in).

Zope3-dev mailing list

Reply via email to