Martijn Faassen wrote:
I just tried to write AnnotationAdapter. Unfortunately, I haven't gotten very far yet, as it turns out I need to understand the internals of the implementation of the zope:adapter ZCML statement.

No, you don't.

zope:adapter has a bunch of automation to look for the interface of something and what it adapts on the factory. This works if the factory is the class itself, but in this case, the factory is a class which has instances which can provide an instance of the annotation class when called.

This may not be documented as well as it should be, but not for lack of

1. You can always provide the interface provided by an adapter
   when you register it.

2. If a factory declares that it implements a single interface,
   then you can omit the interface when registering the adapter.

   If a factory is a class, it typically declares that it implements
   an interface via the implements call in the class statement.

   If a factory is not a class, and if it allows attributes to be
   set on it, then the interface.implementor function can be used to make
   declarations for it.  This is documeted in zope/interfaces/README.txt
   and zope/component/README.txt.


Jim Fulton           mailto:[EMAIL PROTECTED]       Python Powered!
CTO                  (540) 361-1714  
Zope Corporation
Zope3-dev mailing list

Reply via email to