Chris Withers wrote:
Philipp von Weitershausen wrote:
Chris Withers wrote:
Can a named adapter find out the name it was registered with during the adaptation process?


I can see why it's that way, but it seems a shame and maybe even an oversight :-/

What do you suggest I do when the adapter needs to know the name it was registered for?

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:


-- -- Professional Zope documentation and training
Zope3-dev mailing list

Reply via email to