<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt"><div>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, <br><br> ConfigurationError: ('Invalid value for', 'menu', "ImportError: Couldn't import zmi_actions, No module named zmi_actions")<br><br>The (simplified) code is as follows:<br><br>from zope.interface import Interface<br>from zope import schema<br>import grok<br>from zope.schema.fieldproperty import FieldProperty<br>from megrok.z3cform.base import PageAddForm, Fields<br><br><br>class
IDocMaster(Interface):<br> title = schema.Text(title=u"The title")<br> template = schema.Bytes(title=u"The template")<br><br>class DocMaster(grok.Model):<br> grok.implements(IDocMaster)<br><br> title = FieldProperty(IDocMaster["title"])<br> template= FieldProperty(IDocMaster["template"])<br><br> def __init__(self, title, template):<br> self.title = title<br> self.template = template<br><br>class DocAdd(PageAddForm):<br> grok.context(Interface) #actually a specialised container<br> <br> fields = Fields(IDocMaster)<br> label = "New doc"<br> <br> def createAndAdd(self, data):<br> doc =
DocMaster(**data)<br> id = str(doc.title) #if you use a single word as title this will do<br> self.context[id] = doc<br><br>In setup.py,<br><br>install_requires=[<br> 'setuptools',<br> # -*- Extra requirements: -*-<br> 'zope.browserresource',<br> 'zope.app.pagetemplate',<br> 'z3c.form',<br> 'megrok.z3cform.base',<br> 'megrok.z3cform.ui',<br> 'megrok.z3cform.layout',<br>
'zope.app.schema',<br> 'zc.sourcefactory',<br> 'relatorio',<br> <span style="font-weight: bold;">#IF I INCLUDE THESE THE ABOVE MENTIONED ERROR OCCURS</span><br> 'zope.browsermenu',<br> 'zope.app.container',<br> 'zope.file',<br> 'zope.mimetype',<br> ],<br></div>
</div></body></html>