[Zope3-Users] formlib.form.Action.render()
Christian Lueck
christian.lueck at ruhr-uni-bochum.de
Thu Sep 15 17:09:14 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')
The page is registered with the <browser.page> directive:
<browser:page
name="AddOrder.html"
for=".interfaces.IOrder"
class=".browser.OrderEditView"
menu="zmi_views" title="Edit Order"
permission="zope.ManageContent"
/>
What am I doing wrong?
Kind regards,
Christian Lück
More information about the Zope3-users
mailing list