def __call__(self, form, config, line): identifier = config.getId() if identifier == 'default': if ISMIForm.providedBy(form): form.send_message( _(u'You cannot remove the default configuration.'), type='error') raise silvaforms.ActionError( _(u'You cannot remove the default configuration.')) form.context.manage_delObjects([identifier]) if ISMIForm.providedBy(form): form.send_message(_(u'Configuration for ${name} removed.', mapping=dict(name=identifier)), type='feedback') return silvaforms.SUCCESS
def get_smi_form(self): form = self.form while form is not None and not ISMIForm.providedBy(form): form = getattr(form, 'parent', None) return form