[Grok-dev] Re: grok.Permission and grok.Role

Martijn Faassen faassen at startifact.com
Tue Aug 28 06:15:28 EDT 2007


Jan-Wijbrand Kolman wrote:
> Jan-Wijbrand Kolman wrote:
>> Philipp von Weitershausen wrote:
>>> I apologize if this feedback comes a bit late, though I guess it's 
>>> not too late to potentially change anything.
> snip
>> I *hope* I can dedicated a bit of time next week to refactor, if noone 
>> else has the opportunity.
> 
> I have implemented your suggestion on the 
> jw-proper-components-for-role-permission branch.
> 
> Permssion definitions now look like:
> 
>   class MyPermission(grok.Permission):
>     id = 'my.permission'
>     title = u'My Permission' # should this be optional?
>     description = u'When you're allowed to foobar' # optional
> 
> Role permission now look like:
> 
>   class MyRole(grok.Role):
>     id = 'my.role'
>     title = u'My Role' # should this be optional?
>     description = u'When you're a Bazqux' # optional
>     grok.permissions('my.permission', ...)
> 
> There's no realy "grokified' error reporting yet when you forget about 
> the id and/or title attribute on your permission and role classes.
> 
> I'll merge this with the trunk after I get feedback on this change.

I'm fine if these can be "real" permissions and roles without many
problems, but to set them up in a new way with hardly a precedent is a
unsettling to me.

So, I object against initialization without grok directives. The way 
these get set up is not in any way consistent with the rest of Grok.

Elsewhere, we were discussing the potential for the general introduction
of something like grok.describe (or grok.title and grok.description) for
arbitrary grok objects. This way we can easily have human readable text
which we reuse in user interface menus and the like. Information like
this can also become useful within the admin UI for practically any kind
of object. It would therefore be a shame if we broke this pattern with 
permissions.

I'm already a bit unsettled by form_fields on forms and the way indexes
are set up for grok.Indexes, but couldn't think of a better way and both
at least use directives like grok.name() for naming things.

Regards,

Martijn



More information about the Grok-dev mailing list