[Grok-dev] Re: Recipe for "egg-like" reuse?
Sebastian Ware
sebastian at urbantalk.se
Wed Apr 9 08:37:17 EDT 2008
9 apr 2008 kl. 14.29 skrev Uli Fouquet:
> You shouldn't have to fiddle with ZCML files for this. That's what
> Grok
> is for. Including the package as shown above should be sufficient.
> Don't
> forget to rerun buildout afterwards.
I went all in and fiddled everywhere... :) I got the hint to update
configure.zcml by looking at how the grok admin interface was
registered, but I realised that it was probably the wrong way.
>
>
>> in configure.zcml. I have reverted to your suggestion and it works
>> equally well. Now I am only struggling to get the grok.Permissions to
>> work again. I have defined:
>>
>> class ViewContacts(grok.Permission):
>> grok.name('protoncms.EditUser')
>>
>> But I still get the error "Undefined permission
>> 'protoncms.EditUser'".
>
> Did you define the permission in the protoncms package? In the same
> module where you use 'grok.require('protoncms.EditUser')? Does the
> failure show up at startup? I must confess, I get a bit confused here.
I defined the permission 'my.perm' in app.py of the protoncms package.
The error shows up during startup when I add a
grok.requires('my.perm') to a view in the protoncms package, claiming
that I haven't defined the permission. I have double and tripple
checked the spelling. And the code did work prior to refactoring.
mvh Sebastian
jhsware$ parts/app/runzope -C parts/zopectl/zope.conf
Traceback (most recent call last):
File "parts/app/runzope", line 112, in ?
zope.app.twisted.main.main()
File "/Users/jhsware/groksandbox/eggs/tmp6qlVKK/
zope.app.twisted-3.4.0a1-py2.4.egg/zope/app/twisted/main.py", line 74,
in main
File "/Users/jhsware/groksandbox/eggs/tmp6qlVKK/
zope.app.twisted-3.4.0a1-py2.4.egg/zope/app/twisted/main.py", line
145, in setup
File "/Users/jhsware/groksandbox/eggs/zope.app.appsetup-3.4.1-
py2.4.egg/zope/app/appsetup/appsetup.py", line 111, in config
context = xmlconfig.file(file, context=context, execute=execute)
File "/Users/jhsware/groksandbox/eggs/tmp0uWzV7/
zope.configuration-3.4.0-py2.4.egg/zope/configuration/xmlconfig.py",
line 612, in file
File "/Users/jhsware/groksandbox/eggs/tmp0uWzV7/
zope.configuration-3.4.0-py2.4.egg/zope/configuration/config.py", line
610, in execute_actions
File "/Users/jhsware/groksandbox/eggs/tmpQbfK7k/grok-0.11.1-
py2.4.egg/grok/util.py", line 43, in make_checker
File "/Users/jhsware/groksandbox/eggs/tmpQbfK7k/grok-0.11.1-
py2.4.egg/grok/util.py", line 59, in check_permission
zope.configuration.config.ConfigurationExecutionError:
martian.error.GrokError: Undefined permission 'protoncms.EditUser' in
<class 'protoncms.protonuser.Edit'>. Use grok.Permission first.
in:
File "/Users/jhsware/groksandbox/Navicast/ProtonCMS/src/protoncms/
configure.zcml", line 4.2-4.27
<grok:grok package="." />
>
>
> Kind regards,
>
> --
> Uli
More information about the Grok-dev
mailing list