[Zope3-Users] z3c.form and subforms in an AddForm?

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Jul 4 16:50:55 EDT 2007


On Wednesday 04 July 2007 14:00, Hermann Himmelbauer wrote:
> >   File "/opt/zope/python2.4/lib/python2.4/site-packages/z3c.form-
> > 1.3.0-py2.4.egg/z3c/form/form.py", line 167, in updateWidgets
> >     self.widgets = zope.component.getMultiAdapter(
> >   File "/opt/zope/zope-3.4.0a1/lib/python/zope/component/_api.py", line
> > 103, in getMultiAdapter
> >     raise ComponentLookupError(objects, interface, name)
> > zope.component.interfaces.ComponentLookupError: ((<
> > z3c.pagelet.zcml.NextActionAddForm object at 0x2b69896b4850>, <
> > zope.publisher.browser.BrowserRequest instance URL=
> > http://localhost:9080/++skin++MovingTargetBrowser/addNextAction.html>, <
> > zope.app.folder.folder.Folder object at 0x2b69896eb0c8>), <InterfaceClass
> > z3c.form.interfaces.IWidgets>, u'')
> >
> > I keep reading over the .txt files in z3c.form, and I feel like I may be
> > missing some line. Do I need a datamanager? My schema is pretty
> > straightforward:
>
> I'm pretty clueless here, too. What I however don't understand why an
> adapter for a Folder object is queried.

There is no special adapter for folder. It is a triplet-adapter for (form, 
request, context). The context just happens to be a folder. But the default 
IWidgets adapter is registered for (IFieldsForm, IFormLayer, Interface), 
which effectively means that any context will work.

> However, I think the interface is fine and I don't think you need a
> datamanager in your case. I'd check if the request is marked with a
> IFormLayer, though.

Yep IFormLayer is important to inherit in your skin.

> Here's once again the newbie problem: there's a query for an adapter, which
> is for sure registered somewhere in the package, however the objects are
> probably not marked with the right interfaces, so the query fails and it's
> hard to find out why...

I'll note that APIDOC is your friend.

1. I just started up Zope 3, where z3c.form* is installed.
2. Start APIDOC: http://localhost:8080/++apidoc++
3. Click on the "Interfaces" module
4. Search for "IWidgets"
5. Click on "z3c.form.interfaces.IWidgets"
6. Go to the section "Adapters that provide this interface:"

There you see one entry that tells you how the adapter is registered. You then 
basically have to make sure that your objects provide the necessary 
interfaces.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list