[Grok-dev] z3c.form
Toni Mueller
support at oeko.net
Tue Jul 15 14:17:14 EDT 2008
Hi,
I find it non-obvious how to use z3c.form. There's a simple example of
how to make an "AddForm" in the docs, but (maybe because I don't
understand Grokkers?) trying to copy that yields a traceback because I
don't have a 'request' object.
My playground app currently looks like this:
class MyApp(grok.Application, grok.Container):
grok.traversable('add')
def traverse(self, name):
if name == 'add':
return MyAddForm()
else:
raise NotImplementedError
class MyAddForm(z3c.form.form.AddForm):
...
Running this yields this error:
TypeError: __init__() takes exactly 3 arguments (1 given)
Digging the code suggests that there's a suitable request object,
outside of Grok, in zope.publisher.base line 263, and then some down in
grok.components in traverse(), line 488, where I have a
grok.components.ContainerTraverser object which contains a 'request'
subobject. One stack frame down, in my custom traverse() function shown
above, I can't see the object anymore.
Pointers to suitable reading are most welcome!
Kind regards,
--Toni++
PS: I'll didn't yet get around to digging up the mars.* & co examples
that were posted here over time. If the explanation is in there,
I'd like to apologize in advance.
More information about the Grok-dev
mailing list