[z3-five] formlib acquisition error
Tim Hicks
tim at sitefusion.co.uk
Tue Feb 6 11:27:12 CET 2007
Daniel Nouri wrote:
> Hi!
>
> I'm using Five 1.4.1 with Zope 2.9.6 and using the (base-) classes
>
> Products.Five.formlib.formbase.PageForm
> Products.Five.browser.pagetemplatefile.ViewPageTemplateFile
>
> I'm trying to call self.template() in an action handler, but that fails
> because self (the form) is not acquistion-wrapped (at all) in the body
> of the action handler, thus
>
> @form.action("foo")
> def action_foo(self, action, data):
> return self.template()
>
> is bound to fail.
I had a problem like this a few weeks ago. When I discussed it with
alecm on #plone, he seemed to know what was causing the problem
(something to do with the form.action decorator storing objects in such
a way that acquisition got stripped). Unfortunately, the appropriate
fix was, apparently, not obvious or easy.
The workaround that I employed was to simply declare my template as a
full-blown view and then look it up with getMultiAdapter instead of as
an attribute of the form.
Maybe alecm can remember more...
Tim
More information about the z3-five
mailing list