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

Hector Blanco white.lists at gmail.com
Thu Jan 13 10:51:57 EST 2011


It's working great!

As I explained in my former mail
(https://mail.zope.org/pipermail/grok-dev/2011-January/011014.html), I
have the .py modules I develop outside the main server folder:

+ myOwn-cms/
+              backlib/
>                     user/
>                         User.py
>                         Permissions.py
    [ ... other external modules ...]

+              server/
>                     configure.zxml
>                     bin/
>                     log/
>                     parts/
>                     src/
>                         server/
>                              app.py
>                              rest.py

So in this case, the configure.zxml looks like this:

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

And works perfectly!

Thanks a lot!



2011/1/13 Jan-Wijbrand Kolman <janwijbrand at gmail.com>:
> 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
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev
>


More information about the Grok-dev mailing list