[Grok-dev] Help with z3c.form and zope.file
Danilo G B
danilogbotelho at yahoo.com
Thu Jun 2 17:30:12 EDT 2011
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',
],
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/grok-dev/attachments/20110602/de42122d/attachment.html
More information about the Grok-dev
mailing list