[Grok-dev] Help with z3c.form and zope.file

Jan-Wijbrand Kolman janwijbrand at gmail.com
Wed Jun 15 05:46:44 EDT 2011


On 6/2/11 23:30 , Danilo G B wrote:
> Hey guys, please help me! I'm using Grok 1.4, z3c.form 2.4.2 and need a
> field to hold an uploaded file. I would like to have something as close
> as possible to plone.formwidget.namedfile. Whether I depend on
> z3c.namedfile, zope.app.file or zope.file the result is ultimately the
> same: complains about dependencies that goes down to the point where I
> can't go further, i.e,
> 
>     ConfigurationError: ('Invalid value for', 'menu', "ImportError:
> Couldn't import zmi_actions, No module named zmi_actions")
> 
> The (simplified) code is as follows:
> 
> from zope.interface import Interface
> from zope import schema
> import grok
> from zope.schema.fieldproperty import FieldProperty
> from megrok.z3cform.base import PageAddForm, Fields
> 
> 
> class IDocMaster(Interface):
>     title = schema.Text(title=u"The title")
>     template = schema.Bytes(title=u"The template")
> 
> class DocMaster(grok.Model):
>     grok.implements(IDocMaster)
> 
>     title = FieldProperty(IDocMaster["title"])
>     template= FieldProperty(IDocMaster["template"])
> 
>     def __init__(self, title, template):
>         self.title = title
>         self.template = template
> 
> class DocAdd(PageAddForm):
>     grok.context(Interface) #actually a specialised container
>    
>     fields = Fields(IDocMaster)
>     label = "New doc"
>    
>     def createAndAdd(self, data):
>         doc = DocMaster(**data)
>         id = str(doc.title) #if you use a single word as title this will do
>         self.context[id] = doc
> 
> In setup.py,
> 
> install_requires=[
>           'setuptools',
>           # -*- Extra requirements: -*-
>           'zope.browserresource',
>           'zope.app.pagetemplate',
>           'z3c.form',
>           'megrok.z3cform.base',
>           'megrok.z3cform.ui ',
>           'megrok.z3cform.layout',
>           'zope.app.schema',
>           'zc.sourcefactory',
>           'relatorio',
>           #IF I INCLUDE THESE THE ABOVE MENTIONED ERROR OCCURS
>           'zope.browsermenu',
>           'zope.app.container',
>           'zope.file',
>           'zope.mimetype',
>       ],

Do you trigger the configuration for the last four dependencies from
your application? (by way of an include statement in your application's
configure.zcml?).

It seems the necessary menu components are not registered. But I'm not sure.

Are these extra dependencies for zope.file?

regards, jw




More information about the Grok-dev mailing list