[Zope-CMF] Re: [dev] CMF 1.5 roadmap?

Dieter Maurer dieter at handshake.de
Thu Feb 26 16:39:08 EST 2004


yuppie wrote at 2004-2-26 10:51 +0100:
> ...
>Sorry. But these 'actions' are stored in *FormAction* objects. The fact 
>the documentation just talks about 'actions' isn't very helpful to 
>distinguish them from CMF's Actions.

But where they are implemented is not, either...

The "FormController" actions are similar to automatic transitions.
They can fire depending on a state. These actions
enter a terminal state. Validators, too, can be seen as
transitions that transform a state successively.

> ...
>> [validators]
>> validators..Upload=validate_id,validate_metadata_upload_xml
>> validators..EditMappings=validate_id,validate_metadata_edit_mappings
>> 
>> [actions]
>> action.success..Upload=traverse_to:string:metadata_upload_xml
>> action.success..EditMappings=traverse_to:string:metadata_edit_mappings
>> action.success..Cancel=traverse_to:string:plone_control_panel
>> action.failure=traverse_to:string:prefs_metadata_form
> ...
>## Script (Python) "prefs_metadata_control"
>##parameters=Upload=None, EditMappings=None, Cancel=None, **control
>##
>from Products.CMFCore.utils import getToolByName
>mtool = getToolByName(context, 'portal_membership')
>
>if Upload:
>     control = context.validate_id(control)
>     control = context.validate_metadata_upload_xml(control)
>     if control['status'] == 'success':
>         control = context.metadata_upload_xml(control)
>
>elif EditMappings:
>     control = context.validate_id(control)
>     control = context.validate_metadata_edit_mappings(control)
>     if control['status'] == 'success':
>         control = context.metadata_edit_mappings(control)
>
>elif Cancel:
>     target = mtool.getActionInfo('user/plone_setup')['url']
>     context.REQUEST.RESPONSE.redirect(target)
>     return
>
>return control

I prefer the "CMFFormController" specification.

Especially, site specific customization is far easier.

-- 
Dieter



More information about the Zope-CMF mailing list