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

Paul Winkler pw_lists at slinkp.com
Tue Nov 28 14:04:42 EST 2006


On Tue, Nov 28, 2006 at 06:12:19PM +0000, Chris Withers wrote:
> Is there a python-only way to register adapters instead of in ZCML and,
> if it exists, is it safe to use in conjunction with the normal zcml dances?

There's always a way :)

You could just do what the directive does - call the adapter()
function which used to be in zope.app.component.metaconfigure but now
lives in zope.component.zcml. I haven't done it but AFAICT it should
work safely.

It's sometimes instructive to look at how directives are implemented.
Find the meta.zcml file that declares the directive, and that'll tell
you what module contains the schema and handler for that directive.
The handler does the work.

-- 

Paul Winkler
http://www.slinkp.com


More information about the Zope3-dev mailing list