[Grok-dev] Re: defining permissions in a module

Philipp von Weitershausen philipp at weitershausen.de
Tue Jul 24 10:54:26 EDT 2007


On 24 Jul 2007, at 16:52 , Jan-Wijbrand Kolman wrote:
> On 7/24/07, Philipp von Weitershausen <philipp at weitershausen.de>  
> wrote:
>> > This *does* work, but still feel ugly as in fact the permissions  
>> will
>> > get registered twice. In practice this cannot really hurt, but,  
>> well,
>> > feels ugly :-)
>>
>> How about allow modules to say that they depend on other modules  
>> being
>> grokked first, e.g.::
>>
>>    from myapp import permissions
>>
>>    grok.depends(permissions)
>>
>>    class MyView(grok.View):
>>        grok.require(permissions.DISPLAY_VIEW)
>
> It's at least a lot cleaner than relying on double registrations of
> the permissions not to have nasty side-effects...
>
> Well, if the grok.depends could actually make sure the permissions
> module is not grokkked again, but I guess that *is* your intention
> here.

Well, the idea is that you only ever put one grok.define_permission()  
in myapp.permissions.

> Martijn, what's your view on this in relation to martian?

This would obviously be a martian feature.



More information about the Grok-dev mailing list