tim.terlegard at valentinewebsystems.se
Tue Jul 15 15:09:25 EDT 2008
On Jul 15, 2008, at 8:17 PM, Toni Mueller wrote:
> I find it non-obvious how to use z3c.form. There's a simple example of
> how to make an "AddForm" in the docs
Did you also see z3c.formdemo?
> , 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):
> def traverse(self, name):
> if name == 'add':
> return MyAddForm()
> raise NotImplementedError
> class MyAddForm(z3c.form.form.AddForm):
> Running this yields this error:
> TypeError: __init__() takes exactly 3 arguments (1 given)
I haven't used z3c.form myself, but i would except AddForm to be a view,
that means the constructor wants a context and a request.
so MyAddForm(self.context, self.request) would perhaps work better.
I don't think it causes the error, but you don't need
grok.traversable('attr') makes the 'attr' attribute on the class/object
traversable. But you don't have any 'add' attribute in your code. The
traverse() method works without that.
More information about the Grok-dev