[Zope3-dev] Re: Can an adapter find out what name it was registered for?

Chris Withers chris at simplistix.co.uk
Tue Nov 28 13:09:57 EST 2006


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?

> This seems somewhat analogous to a Python object being given multiple 
> names.  In that case too, there is no way for the object to know what 
> it's names are.

Hmmm, okay, but I'd counter with both Zope 2 and Zope 3 having the 
notion of an object knowing its own name. Certainly in Zope 2, 
everything has an id or .getId(). That pattern evolved for a reason ;-)

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk


More information about the Zope3-dev mailing list