[Grok-dev] Re: grok.define_role

Jan-Wijbrand Kolman janwijbrand at gmail.com
Thu Aug 2 03:14:14 EDT 2007


On 8/1/07, Martijn Faassen <faassen at startifact.com> wrote:
> 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
> first.
>
> 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.

I'm neutral on the module-level directive versus class definition, but
I would like to see defining permissions and defining roles to be
spelled in a similar manner. Would it make sense then to rather see
grok.define_role deprecated and have:

  class MyPermissionName(grok.Permission):
      grok.name('My Nice Permission Name')

Kind regards,
jw

-- 
Jan-Wijbrand Kolman


More information about the Grok-dev mailing list