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

Chris Withers chris at simplistix.co.uk
Tue Nov 21 05:57:11 EST 2006


Philipp von Weitershausen wrote:
> If you really really want the adapter to be aware of its name, you could 
> walk thru the adapter registrations of the component registry until you 
> find one that refers to the adapter, e.g. (pseudoish code):
> 
> registry = zope.component.getSiteManager()
> for registration in registry.registeredAdapters():
>     if registration.factory is YourAdapterClass:
>         return registration.name

Waagh :'(

Chris

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


More information about the Zope3-dev mailing list