[Zope3-Users] Re: formlib.form.Action.render()

Ruslan Spivak rspivak at nuxeo.com
Tue Sep 27 17:51:28 EDT 2005


> Hi there!
>
> I have a problem with formlib, form.Fields are rendered correctly :) but
> I got stuck with Actions
> Well, I followed the lines of formlib/form.txt
> but adapted the examples for use with ZPT by overridding the template
> method:
> template = ViewPageTemplateFile('mytemplate.pt')
>
> The widgets are rendered one by one by methods in the viewclass which
> return self.widgets['field_x']()
>
> That works fine :-)
> But when I try to get the action-objects rendered there is an exception.
>
> class Myform(EditForm):
>     <snip>
>     def renderActions(self):
>         result = []
>         for action in self.actions:
>             result.append(action.render())
>         return '\n'.join(result)
>
> The action.render() call causes a component lookup error:
>
> <snip>
> Module formlibexample.browser, line 89, in renderActions
>     result.append(action.render())
>   Module zope.formlib.namedtemplate, line 61, in __get__
>     return component.getAdapter(instance, INamedTemplate, self.__name__)
>   Module zope.component, line 141, in getAdapter
>     raise ComponentLookupError(object, interface, name)
> ComponentLookupError: (<zope.formlib.form.Action object at 0xb01acb6c>,
> <InterfaceClass zope.formlib.namedtemplate.INamedTemplate>, 'render')
>

Looks like you didn't include `formlib` package into package-includes.

Regards,
Ruslan



More information about the Zope3-users mailing list