[Zope3-Users] Error when calling addform
Tom Dossis
td at yoma.com.au
Sun Feb 11 13:50:20 EST 2007
Florian Lindner wrote:
> Hello,
> I have an addform registered:
>
> <addform
> label="Add Blog Comment"
> name="AddBlogComment.html"
> schema="..interfaces.IBlogComment"
> content_factory="..blog.BlogComment"
> permission="Blog.AddComment"
> />
>
> <addMenuItem
> class="..blog.BlogComment"
> title="Blog Comment"
> description="A Blog Comment"
> permission="Blog.AddComment"
> view="AddBlogComment.html"
> />
>
>
> class IBlogComment(IContained):
> containers(IBlogEntry)
>
> name = TextLine(
> title = u"Your name",
> description = u"Your name or nickname",
> default = u"Guest",
> required = True)
>
>
> email = TextLine(
> title = u"E-Mail",
> required = False)
>
> content = Text(
> title = u"Blog comment content",
> default = u"",
> required = True)
>
>
> class BlogComment(Contained):
> """ A comment to a Blog entry. """
> implements(IBlogComment)
>
> name = u""
> email = u""
> content = u""
>
>
> but when I call the addform resp. click on the addMenuItem I get an system
> error:
>
> 2007-02-11T19:19:46 ERROR SiteError
> http://localhost:8080/xgm/Blog/2007_02_10_erster_post/+/AddBlogComment.html
...
> ComponentLookupError: ((<zope.schema._bootstrapfields.Field object at
> 0x9e95b2c>, <zope.publisher.browser.BrowserRequest instance
> URL=http://localhost:8080/xgm/Blog/2007_02_10_erster_post/+/AddBlogComment.html>),
> <InterfaceClass zope.app.form.interfaces.IInputWidget>, u'')
>
>
>
> .... what do I have misconfigured here?
IBlogComment has picked up the fields __parent__ and __name__ from
IContained.
Try explicitly specifying the IBlogComment fields in the addform
directive: set_before_add, e.g.
set_before_add="name email content"
If you add an __init__ constructor to BlogComment then you could use the
fields or keyword_arguments instead, e.g.
fields="name email content"
-Tom
More information about the Zope3-users
mailing list