[Grok-dev] Put the user-defined permissions in a separate .py file?

Jan-Wijbrand Kolman janwijbrand at gmail.com
Thu Jan 13 03:28:32 EST 2011


On 1/12/11 18:24 PM, Hector Blanco wrote:
> Agh... It seems close... The best result (I think) I've got is by doing:
>
>   ------------ configure.zcml ----------------
> <configure xmlns="http://namespaces.zope.org/zope"
>             xmlns:grok="http://namespaces.zope.org/grok">
>    <include package="grok" />
>    <includeDependencies package="." />
>    <include package="backlib.user.Permissions"/>
>    <grok:grok package="." />
> </configure>
> -------------------------------------------------

Ah, yes, sorry, I made a mistake in my example. My intention was to show 
how to *grok* a specific module, in order to have its contents 
registered for other components to use.

So my example here was wrong..:

>> configure.zcml:
>>
>>    <configure
>>      xmlns="http://namespaces.zope.org/zope"
>>      xmlns:grok="http://namespaces.zope.org/grok"
>>      >
>>      <include package="grok" />
>>      <includeDependencies package="." />
>>
>>      <include package="MyApp.permission"/>
>>      <include package="MyApp" />
>>
>>    </configure>

...I meant to have it look like this:

configure.zcml:

    <configure
      xmlns="http://namespaces.zope.org/zope"
      xmlns:grok="http://namespaces.zope.org/grok"
      >
      <include package="grok" />
      <includeDependencies package="." />

      <grok:grok package=".themoduletogrokfirst" />
      <grok:grok package="." />

    </configure>

This will grok (register) whatever components are in 
``.themoduletogrokfirst`` first (where the "." is a shortcut for "this 
package", you can of course also use the full dotted path to a module).

I hope this *does* help instead of misguiding you... :)

regards, jw



More information about the Grok-dev mailing list