Re: [Zope3-Users] EditForm fails in SiteManager because of containment constraint
Am Samstag, 7. April 2007 18:06 schrieb Christophe Combelles: Hello, I have a regular content object which uses the formlib for its edit view. Nothing special, just like a Recipe. But I want this object to only reside in the Site Manager, because it will be used as a configurable local utility (some kind of LocalKitchenTools utility) Everything is perfect, and the EditForm works well until I want to tell this object to be only contained in the SiteManager. So I just add this statement in the interface: containers(ILocalSiteManager) or containers(ISiteManagementFolder) When I do any of these, the EditForm fails with a ComponentLookupError What Am I missing? Why does a simple constraint create an error on this? I *think* I've got the same problem - the thing is that interfaces inheriting from container interfaces inherit the __name__ and __parent__ attributes. And the formlib classes try to set up widgets for these attributes, which results in a component lookup error. I simply omitted these two attributes, which solved the problem. Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
[Zope3-Users] EditForm fails in SiteManager because of containment constraint
Hello, I have a regular content object which uses the formlib for its edit view. Nothing special, just like a Recipe. But I want this object to only reside in the Site Manager, because it will be used as a configurable local utility (some kind of LocalKitchenTools utility) Everything is perfect, and the EditForm works well until I want to tell this object to be only contained in the SiteManager. So I just add this statement in the interface: containers(ILocalSiteManager) or containers(ISiteManagementFolder) When I do any of these, the EditForm fails with a ComponentLookupError What Am I missing? Why does a simple constraint create an error on this? Christophe Error object: ((zope.schema._bootstrapfields.Field object at 0xb58a9bec, zope.publisher.browser.BrowserRequest instance URL=http://localhost:9673/++lang++en/++skin++Debug/testsite/++etc++site/default/ppp/@@edit.html), InterfaceClass zope.app.form.interfaces.IInputWidget, u'') File /usr/lib/python2.4/site-packages/zope/publisher/publish.py, line 133, in publish result = publication.callObject(request, obj) File /usr/lib/python2.4/site-packages/zope/app/publication/zopepublication.py, line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) File /usr/lib/python2.4/site-packages/zope/publisher/publish.py, line 108, in mapply return debug_call(obj, args) File /usr/lib/python2.4/site-packages/zope/publisher/publish.py, line 114, in debug_call return obj(*args) File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 769, in __call__ self.update() File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 732, in update self.setUpWidgets() File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 802, in setUpWidgets adapters=self.adapters, ignore_request=ignore_request File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 393, in setUpEditWidgets widget = _createWidget(form_field, field, request, iface) File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 323, in _createWidget return component.getMultiAdapter((field, request), iface) File /usr/lib/python2.4/site-packages/zope/component/_api.py, line 103, in getMultiAdapter raise ComponentLookupError(objects, interface, name) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users
Re: [Zope3-Users] EditForm fails in SiteManager because of containment constraint
OK, I've finally found, Actually, it was failing also in the content side My object is not IContained. And since I'm adding containment constraints, I guess my object was considered Contained (containment proxy?). So the EditForm was expecting __name__ and __parent__ and was failing somewhere. I've just added omit('__name__', '__parent__') in the form and it works. But I can't explain why I have to add this omit() when my object is not contained. Is it silly to add a containment constraint on a not Contained object? Shouldn't the containment proxy manage this by itself? Christophe Christophe Combelles a écrit : Hello, I have a regular content object which uses the formlib for its edit view. Nothing special, just like a Recipe. But I want this object to only reside in the Site Manager, because it will be used as a configurable local utility (some kind of LocalKitchenTools utility) Everything is perfect, and the EditForm works well until I want to tell this object to be only contained in the SiteManager. So I just add this statement in the interface: containers(ILocalSiteManager) or containers(ISiteManagementFolder) When I do any of these, the EditForm fails with a ComponentLookupError What Am I missing? Why does a simple constraint create an error on this? Christophe Error object: ((zope.schema._bootstrapfields.Field object at 0xb58a9bec, zope.publisher.browser.BrowserRequest instance URL=http://localhost:9673/++lang++en/++skin++Debug/testsite/++etc++site/default/ppp/@@edit.html), InterfaceClass zope.app.form.interfaces.IInputWidget, u'') File /usr/lib/python2.4/site-packages/zope/publisher/publish.py, line 133, in publish result = publication.callObject(request, obj) File /usr/lib/python2.4/site-packages/zope/app/publication/zopepublication.py, line 161, in callObject return mapply(ob, request.getPositionalArguments(), request) File /usr/lib/python2.4/site-packages/zope/publisher/publish.py, line 108, in mapply return debug_call(obj, args) File /usr/lib/python2.4/site-packages/zope/publisher/publish.py, line 114, in debug_call return obj(*args) File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 769, in __call__ self.update() File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 732, in update self.setUpWidgets() File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 802, in setUpWidgets adapters=self.adapters, ignore_request=ignore_request File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 393, in setUpEditWidgets widget = _createWidget(form_field, field, request, iface) File /usr/lib/python2.4/site-packages/zope/formlib/form.py, line 323, in _createWidget return component.getMultiAdapter((field, request), iface) File /usr/lib/python2.4/site-packages/zope/component/_api.py, line 103, in getMultiAdapter raise ComponentLookupError(objects, interface, name) ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users ___ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users