[Grok-dev] Re: defining permissions in a module
Philipp von Weitershausen
philipp at weitershausen.de
Tue Jul 24 10:39:53 EDT 2007
Jan-Wijbrand Kolman wrote:
>> But at least now you know of this limitation - or are there actullay
>> better ways to keep permissions in a central place?
>
> What you could do as a workaround is to explicitely grok the
> permission module from the __init__.py of you application...
>
> 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)
--
http://worldcookery.com -- Professional Zope documentation and training
More information about the Grok-dev
mailing list