[Zope3-Users] zope:class for multiple classes / inheriting configuration?

Tom Dossis td at yoma.com.au
Fri Jun 1 18:05:58 EDT 2007

Hermann Himmelbauer wrote:
> Hi,
> I have the problem here that I have to configure several classes, which I 
> currently do via zope's zope:class directive, such as:
> <class class=".foo.f1">
>  <require
>   permission = "zope.View"
>   interface=".interfaces.If1"
>  />
>  <require
>   permission="zope.ManageContent"
>   set_schema=".interfaces.IEmail"
>  />
> </class>
> The only thing that changes throughout the configuration is the interface.
> I have around 20 classes which have to be configured the same, so I wonder if 
> there's some shortcut?

I've used 'like_class', some examples:

    <class class=".MyImage">
        <implements interface=".interfaces.IGalleryItemContained" />
        <require like_class="zope.app.file.interfaces.IImage />

   <class class=".MySite">
        <require like_class="zope.app.folder.Folder" />

> Moreover, does someone know if the configuration of an object is inherited to 
> a child object?

AFAIK, 'class' zcml directives do not.  If you need to 'expose' 20
distinct classes, I think you'll require a zcml class declaration for each.

More information about the Zope3-users mailing list