[Zope3-dev] ZCML alternative

Steve Alexander steve@cat-box.net
Tue, 04 Jun 2002 21:36:05 +0100


Jeffrey P Shell wrote:
>
> I wouldn't mind seeing code like this:
> 
> <security:permission permission_id="Manage Contacts"
>                      title="Manage Contacts"/>
> 
> <zmi:provideClass name="Zope.Contact."
>                   permission_id="Manage Contacts"
>                   title="Contact"
> />
> 
> <security:protectClass name="Zope.Contact."
>                   permission_id="Zope.View"
>                   methods="name, first, last, email, address, postal_code"
> />
> 
> 
> Turned into:
> 
> <zmi>
>  <provide-class name="Zope.Contact."
>                 permission="Manage contacts"
>   >Contact</provide-class>
> </zmi>
> 
> <security>
>  <permission id="Manage Contacts">Manage Contacts</permission>
>  <protect-class name="Zope.Contact." permission="Zope.View">
>   <method>name</method>
>   <method>first</method>
>   <method>last</method>
>   <method>email</method>
>   <method>address</method>
>   <method>postal_code</method>
>  </protect-class>
> </security>

Namespaces are important for making the configuration system extensible.


> Or something similar. 

On the latest development branch, due to be merged later this week, this 
looks something like:


   <security:permission
       id="Zope.Manage"
       title="Manage Contacts"/>

   <content class="Zope.Contact.">
     <security:require
         permission="Zope.View"
         attributes="name first last email address postal_code" />
     <zmi:factory
         id="Zope.Contact"
         permission="Zope.Manage"
         title="Contact" />
   </content>


Note that this isn't actually exactly a correct or meaningful example, 
but I was using the declarations you made above as a basis

--
Steve Alexander