[Zope3-Users] Error when calling addform
David Johnson
djohnson at jsatech.com
Mon Feb 12 15:56:22 EST 2007
Many people have offered approaches. I find the simplest and
cleanest approach for declaring interfaces is as follows:
class IContactList(IContainer):
contains('.IContact')
class IContact(Interface):
...schema fields...
class IContactContained(IContained):
containers(IContactList)
Basically, the schema used in your addform CANNOT include IContained.
On Feb 11, 2007, at 7:26 PM, 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
> Traceback (most recent call last):
> File "/home/florian/Zope3/src/zope/publisher/publish.py", line
> 130, in
> publish
> obj = request.traverse(obj)
> File "/home/florian/Zope3/src/zope/publisher/browser.py", line
> 511, in
> traverse
> ob = super(BrowserRequest, self).traverse(obj)
> File "/home/florian/Zope3/src/zope/publisher/http.py", line 447,
> in traverse
> ob = super(HTTPRequest, self).traverse(obj)
> File "/home/florian/Zope3/src/zope/publisher/base.py", line 263,
> in traverse
> obj = publication.traverseName(self, obj, entry_name)
> File "/home/florian/Zope3/src/zope/app/publication/
> publicationtraverse.py",
> line 55, in traverseName
> ob2 = ob.publishTraverse(request, nm)
> File "/home/florian/Zope3/src/zope/app/publisher/browser/
> viewmeta.py", line
> 271, in publishTraverse
> view = queryMultiAdapter((self, request), name=name)
> File "/home/florian/Zope3/src/zope/component/_api.py", line 114, in
> queryMultiAdapter
> return sitemanager.queryMultiAdapter(objects, interface, name,
> default)
> File "/home/florian/Zope3/src/zope/component/registry.py", line
> 206, in
> queryMultiAdapter
> return self.adapters.queryMultiAdapter(
> File "/home/florian/Zope3/src/zope/interface/adapter.py", line
> 482, in
> queryMultiAdapter
> result = factory(*objects)
> File "/home/florian/Zope3/src/zope/app/form/browser/editview.py",
> line 62,
> in __init__
> self._setUpWidgets()
> File "/home/florian/Zope3/src/zope/app/form/browser/add.py", line
> 48, in
> _setUpWidgets
> setUpWidgets(self, self.schema, IInputWidget,
> names=self.fieldNames)
> File "/home/florian/Zope3/src/zope/app/form/utility.py", line
> 153, in
> setUpWidgets
> context=context)
> File "/home/florian/Zope3/src/zope/app/form/utility.py", line 97, in
> setUpWidget
> widget = _createWidget(context, field, viewType, view.request)
> File "/home/florian/Zope3/src/zope/app/form/utility.py", line 65, in
> _createWidget
> return zapi.getMultiAdapter((field, request), viewType)
> File "/home/florian/Zope3/src/zope/component/_api.py", line 103, in
> getMultiAdapter
> raise ComponentLookupError(objects, interface, name)
> 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?
>
> Thanks,
>
> Florian
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
More information about the Zope3-users
mailing list