[Grok-dev] Re: z3c.form
Toni Mueller
support at oeko.net
Wed Jul 16 18:42:13 EDT 2008
Hi Tim,
On Tue, 15.07.2008 at 21:09:25 +0200, Tim Terlegård <tim.terlegard at valentinewebsystems.se> wrote:
> 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?
yes, in the meantime I've digged around in this package, and
subsequently in zope.publisher.browser, too, but to no avail.
> 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.
Grok's AddForm is a View, and z3c.form's AddForm is derived from
"BrowserPage". In the configure.zcml, the corresponding class is
registered as a "z3c:pagelet" (never heard about that).
> so MyAddForm(self.context, self.request) would perhaps work better.
'self.context' does not exist at that point.
> I don't think it causes the error, but you don't need
> grok.traversable('add').
> 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.
Yes, thanks. I've removed the grok.traversable() declaration.
Kind regards,
--Toni++
More information about the Grok-dev
mailing list