[Zope3-dev] adaptation based on class rather than interface

Shane Hathaway shane at hathawaymix.org
Thu Nov 9 10:27:45 EST 2006


Chris Withers wrote:
> Jim Fulton wrote:
>>> <adapter
>>>     for=".myclasses.MyClass"
>>>     provides=".interfaces.ISomething"
>>>     factory=".adapters.MyAdapter"
>>>     />
>>
>> I think it is a fine idea.  That's why it has been supported for
>> a long time.  You can register adapters and views (which, of course
>> are adapters) for classes as well as interfaces.
> 
> Yay! *sound of a million marker interfaces dying*
> 
> Hmm, is this documented anywhere?

The ZCML docs distinguish between fields that require a GlobalObject vs. 
a GlobalInterface.  When a GlobalObject is required, that usually means 
you can specify a class instead of an interface.  Hopefully, the adapter 
directive uses a schema that expects a GlobalObject for the "for" field.

Shane



More information about the Zope3-dev mailing list