[Grok-dev] Re: grok.define_role

Martijn Faassen faassen at startifact.com
Wed Aug 1 14:00:38 EDT 2007

Jan-Wijbrand Kolman wrote:
> I wonder if we want Grok to have something like:
>  grok.define_role('my.rolename', permissions=('my.editpermission',
> 'my.whateverpermissions'))

I hadn't followed this discussion so my apologies for being late!

My general design preference is to try to avoid the introduction of new 
top-level calls as directives and to look at using the class construct 

I'd prefer this to look something like:

   class MyRolename(grok.Role):
      grok.permissions('my.editpermission', 'my.whateverpermission')

This would us to allow things like 'grok.name' to set the real 
underlying name, and perhaps in the future grok.title or grok.label to 
set the UI visible name (should it be needed).

It also allows subclassing of role definitions (inheriting permission 
from above), which may be useful in some cases.

Module-level directives should ideally not be used to create or define 
something, but to configure something.



More information about the Grok-dev mailing list