[Zope3-dev] Proposal to remove simplify zcml
Steve Alexander
steve@cat-box.net
Sat, 02 Mar 2002 13:32:56 +0000
I keep getting caught out when modifying zcml.
Here's what happens:
I'm editing a file such as security.zcml.
<security:protectClass
name="Zope.App.Security.RolePermissionView.PermissionRoles."
permission_id="Zope.Security"
method="roles"
/>
I want to protect rolesInfo as well as roles, so I edit it this:
<security:protectClass
name="Zope.App.Security.RolePermissionView.PermissionRoles."
permission_id="Zope.Security"
method="roles, rolesInfo"
/>
But, when I restart Zope, I get an error:
Zope.Configuration.xmlconfig.ConfigurationExecutionError: class
PermissionRoles
has no attribute 'roles, rolesInfo'
at line 44 column 54 of lib/python/Zope/App/Security/security.zcml
Oh dear. I forgot to change the attribute "method" to "methods".
Going the other way isn't a problem:
<security:protectClass
name="Zope.App.Security.RolePermissionView.PermissionRoles."
permission_id="Zope.Security"
methods="roles"
/>
I think this kind of modification is a very common use-case. I should be
able to change just the value, not the attribute name also.
I think we should follow the decision made for TAL. Consider
tal:attributes. You use "attributes" whether you have one attribute or
several.
So, for zcml, I propose we say that if there is an attribute that could
have one value, or a number of values, we have only the plural attribute
name defined for zcml.
If we agree that this is a good simplification to make, then I volunteer
to make all the changes necessary.
cc: Jim, because we talked briefly about this at the UK Sprint last month.
--
Steve Alexander