[Zope3-dev] Re: Boring product for Zope 3

Philipp von Weitershausen philipp at weitershausen.de
Sat May 22 05:20:49 EDT 2004


Morten W. Petersen wrote:
> Philipp von Weitershausen wrote:
> 
>> Also, you might want to declare that IBoring is a content type 
>> interface, i.e. that it describes a content type, not some other type 
>> of object. You do that in ZCML with:
>>
>>  <interface
>>       interface=".interfaces.IBoring"
>>       type="zope.app.content.interfaces.IContentType"
>>       />
> 
> The same effect can be achieved by letting the IBoring interface
> subclass IContentType in python, right?

No. It is as if the IBoring interface *provided* IContentType:

 >>> from boring.interfaces import IBoring
 >>> from zope.app.content.interfaces import IContentType
 >>> from zope.interface import directlyProvides
 >>> directlyProvides(IBoring, IContentType)

> If so, why use ZCML?

Because being a content type is something that is very specific to 
Zope3. It often only has a meaning in a Zope-context. Yet, if you want 
to use your "boring" class in some other software, you would have a 
dependency on zope.app.content. Using ZCML for this makes it a simple 
configuration directive that can be adjusted without having to dig into 
the code.

Philipp



More information about the Zope3-dev mailing list