Standalone Button in ControlPanelForm

Martin Aspeli optilude at gmx.net
Sun Sep 2 14:17:53 UTC 2007


Christian Klinger wrote:
> Hi,
> 
> i try to make a ControlPanelForm with FormFieldsets.
> Everything works nice so far.
> 
> Now i try to make a Standalone Button in one of my Fieldsets.
> (Something like the "Restart Button" in @@maintenance-controlpanel.
> 
> 
> If i try to add the button like this:
> 
> -------------------------------------------------------------------
> class SolrControlPanel(ControlPanelForm):
Ooooh!  ^^^^

>      form_fields = FormFieldsets(solrcontrol, solrfields,)
>      form_fields['solrfields'].custom_widget=combination_widget
> 
> #    @form.action(_(u'Delete all Plone Entries'), validator=null_validator,)
> #    def handle_shutdown_action(self, action, data):
> -------------------------------------------------------------------
> 
> the other buttons (Save,..) are no more rendered.
> Only the "Delete all Plone Entries" Button is rendered.

Yep, this is how formlib works.

You'll need to replicate or explicitly reference the actions from the 
base class. There is probably a more sensible pattern (e.g. copying 
self.actions in the class?), but I'd need to look up the code. 
Alternatively, you can copy the action specifiers and have a handler 
that just calls super's function.

Martin

-- 
Acquisition is a jealous mistress





More information about the Product-Developers mailing list