[Zope3-Users] EditForm fails in SiteManager because of containment constraint

Christophe Combelles ccomb at free.fr
Sat Apr 7 12:37:46 EDT 2007


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 at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
> 
> 



More information about the Zope3-users mailing list