[Zope3-Users] Still trying am to build an EditForm
Florian Lindner
mailinglists at xgm.de
Sun Sep 2 15:39:56 EDT 2007
Hello,
I am still trying to build an EditForm using z3c.form. Since my previous
thread is rather old I dare to open a new one.
I've tried a number of variations and will post the one which is the closest
to the example.
This is the interface:
class IBlogEntry(IContainer):
"""Interface for blog entry objects."""
contains(IBlogComment)
title = TextLine(
title = _(u"Blog entry title"),
description = _(u"Blog entry title."),
default = u"",
required = True)
content = Text(
title = _(u"Blog entry content"),
description = _(u"Blog entry content."),
default = u"",
required = True)
inputType = Choice(
title = _(u"Type of input"),
description = _(u"Specify the input type"),
required = True,
default = u"reStructeredText",
values = [u"reStructeredText", u"HTML"] )
The view is configured like that:
<z3c:pagelet
name="EditEntry.html"
for="..interfaces.IBlogEntry"
class=".views.EditEntry"
permission="Blog.EditEntry"
layer="Blog.interfaces.IBlogLayer"
/>
The code in .views.EditEntry is:
class EditEntry(layout.FormLayoutSupport, form.EditForm):
fields = field.Fields(IBlogEntry).select("title", "content")
The layer is registered like that:
<interface
interface=".interfaces.IBlogLayer"
name="BlogSkin"
type="zope.publisher.interfaces.browser.IBrowserSkinType"
/>
and
class IBlogLayer(IFormLayer, IPageletBrowserLayer):
"""Demo browser layer using div-form layout template."""
Now I call the URL.
http://localhost:8080/++skin++BlogSkin/Blog/2007_08_16_abc/EditEntry
2007_08_16_abc ist an BlogEntry object.
Now there comes an "ComponentLookupError. A server error occurred. " up.
Traceback (most recent call last):
Module zope.publisher.publish, line 133, in publish
result = publication.callObject(request, obj)
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__: <security proxied z3c.pagelet.zcml.EditEntry instance
at 0xa0248cc>
Module zope.publisher.publish, line 114, in debug_call
return obj(*args)
Module z3c.formui.layout, line 27, in __call__
ILayoutTemplate)
Module zope.component._api, line 103, in getMultiAdapter
raise ComponentLookupError(objects, interface, name)
ComponentLookupError: ((<z3c.pagelet.zcml.EditEntry object at 0xa0248cc>,
<zope.publisher.browser.BrowserRequest instance
URL=http://localhost:8080/++skin++BlogSkin/Blog/2007_08_16_abc/EditEntry.html>),
<InterfaceClass z3c.template.interfaces.ILayoutTemplate>, u'')
I have also tried some variations of the above like not using z3c:pagelet but
an normal page directive, registered it without an layer directive and so on.
So please... whats wrong there?
Thanks,
Florian
More information about the Zope3-users
mailing list