[Grok-dev] grok 1.0 and forbidden attribute error

Lacko Roman rlacko at gratex.com
Sat Jan 9 11:52:30 EST 2010


I'm using megrok.form. i have moved from grok 0.14 to grok 1.0.
I getting following error, when trying to download file that is stored in zodb in field of type megrok.form.fields.File (please see interface bellow):

ForbiddenAttribute: ('form_fields', <klucsite.documentfile.Display object at 0xbde9fcc>)
Traceback (most recent call last):
    * Module zope.publisher.publish, line 133, in publish
      result = publication.callObject(request, obj)
    * Module grok.publication, line 89, in callObject
      return super(ZopePublicationSansProxy, self).callObject(request, ob)
    * Module zope.app.publication.zopepublication, line 167, in callObject
      return mapply(ob, request.getPositionalArguments(), request)
    * Module zope.publisher.publish, line 108, in mapply
      return debug_call(obj, args)
      __traceback_info__: <bound method FileViewDispatcher.__call__ of <zope.app.publisher.browser.viewmeta.FileViewDispatcher object at 0xbdebeec>>
    * Module zope.publisher.publish, line 114, in debug_call
      return obj(*args)
    * Module megrok.form.browser, line 21, in __call__
      form_field = self.context.form_fields.get(field_name, None)

I have following settings i site.zcml:
  <include package="klucsite" />

    <configure i18n_domain="klucsite">

      <unauthenticatedPrincipal id="zope.anybody"
                                title="Unauthenticated User" />
      <unauthenticatedGroup id="zope.Anybody"
                            title="Unauthenticated Users" />
      <authenticatedGroup id="zope.Authenticated"
                        title="Authenticated Users" />
      <everybodyGroup id="zope.Everybody"
                      title="All Users" />
      <principal id="zope.manager"

      <grant permission="zope.View"
             principal="zope.Everybody" />
      <grant permission="zope.app.dublincore.view"
             principal="zope.Everybody" />

      <role id="zope.Manager" title="Site Manager" />
      <role id="zope.Member" title="Site Member" />
      <grantAll role="zope.Manager" />
      <grant role="zope.Manager"
             principal="zope.manager" />

This is interface that i implement:
from megrok.form.fields import File
class IDocumentFile(interface.Interface):
    Title = schema.TextLine(title=_(u'Title'), required=True)
    File = File(title=_(u'File'), required=True)

What other permissions should i set in site.zcml ?
Thanks in advance

- Roman

More information about the Grok-dev mailing list