[Zope3-Users] One single EditForm for several objects

Nordmann Arne arne.nordmann at uni-dortmund.de
Fri Nov 3 05:16:17 EST 2006


Hi there,

 

I have a Problem regarding to the creation and the editing of several
objects with one single form.

I do the creation with an AddForm, which uses formlib, the schemas
IFooContainer und IFooContained and a modified createAndAdd function.
Once the form is sent correctly, it creates a FooContainer object, a
FooContained object and adds FooContained to FooContainer. That's the
way it should be and that's the way it already works.

The actual problem is the EditForm. Basically I do the same as above,
using formlib and the two schemas. But now I get the following
traceback:

------

2006-11-03T10:51:55 ERROR SiteError
http://localhost:8080/foocontainer01/@@editForm.html

Traceback (most recent call last):

  File "C:\Python24\Lib\site-packages\zope\publisher\publish.py", line
138, in publish

    result = publication.callObject(request, object)

  File
"C:\Python24\Lib\site-packages\zope\app\publication\zopepublication.py",
line 161, in callObject

    return mapply(ob, request.getPositionalArguments(), request)

  File "C:\Python24\Lib\site-packages\zope\publisher\publish.py", line
113, in mapply

    return debug_call(object, args)

  File "C:\Python24\Lib\site-packages\zope\publisher\publish.py", line
119, in debug_call

    return object(*args)

  File "C:\Python24\Lib\site-packages\zope\formlib\form.py", line 738,
in __call__

    self.update()

  File "C:\Python24\Lib\site-packages\zope\formlib\form.py", line 707,
in update

    self.setUpWidgets()

  File "C:\Python24\Lib\site-packages\zope\formlib\form.py", line 768,
in setUpWidgets

    adapters=self.adapters, ignore_request=ignore_request

  File "C:\Python24\Lib\site-packages\zope\formlib\form.py", line 345,
in setUpEditWidgets

    adapter = interface(context)

  File "C:\Python24\Lib\site-packages\zope\interface\interface.py", line
682, in __call__

    raise TypeError("Could not adapt", obj, self)

TypeError: ('Could not adapt', <FooContainer object at 0x03080E30>,
<InterfaceClass IFooContained>)

-----

The error seems to occur in the following line (the second one):

class MonolithicEditForm(form.EditForm):

  form_fields =
form.Fields(IFooContainer).__add__(form.FormFields(IFooContained))

That works with the AddForm, but not with the EditForm. How can I tell
the system that several of the formfields belong to the FooContainer
object and the rest belongs to the FooContained object? Is there a way
to do this?

 

Thanks I advance,

 

Arne

 

PS: I'm working with Zope 3.3 and Python 2.4

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20061103/86dd25eb/attachment.htm


More information about the Zope3-users mailing list