[Zope-CMF] Re: [dev] CMF 1.5 roadmap?
Sidnei da Silva
sidnei at awkly.org
Wed Feb 25 14:52:02 EST 2004
On Wed, Feb 25, 2004 at 08:07:43PM +0100, yuppie wrote:
| >The nice thing, IMHO, is that you don't need to modify any python
| >code, or actions, or page templates in order to modify the destination
| >when you submit forms. The (default) configuration is done in
| >.metadata files, and can be changed TTW on a very nicely and
| >well-commented UI.
|
| Why is it better to modify FormActions (that's the place you define
| destinations, right?) than to modify Actions? If there is something
| wrong with the configuration of default Actions (and it is) we should
| improve them instead of adding a second kind of Actions.
There's no such thing as FormActions. You have an 'action' which is
performed when a set of conditions are met, but this has nothing to do
with CMF's Actions (except the fact that you can redirect to an action
by name).
eg:
[default]
title=Advanced Metadata Configuration
[security]
View=0:Authenticated
[validators]
validators..Upload=validate_id,validate_metadata_upload_xml
validators..EditMappings=validate_id,validate_metadata_edit_mappings
validators..Cancel=
[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
There are 4 kinds of actions that can be performed:
traverse_to:tales_expression
traverse_to_action:tales_expression
redirect_to:tales_expression
redirect_to_action:tales_expression
The first part of the action definition will be matched against the
context of the submitted form.
- 'action' is a fixed string for now
- 'success'/'failure' is the state, which you set inside the script
- 'portal_type', which is the portal type of the context object
- 'Upload'/'Cancel' are the names of the buttons clicked
In this example, if the 'state' after running the validators is
'success' and you clicked the button named 'Upload', FormController
will traverse to the 'metadata_upload_xml' object and call it.
Say, you define a *base* set of controller actions, like this:
[actions]
action.success..Save=traverse_to_action:string:edit
action.success..SaveAndView=traverse_to_action:string:view
action.failure=traverse_to_action:string:edit
This could be used for *all* of the CMF default portal types, and if
you want to change behavior, you only need to change this, and doesn't
have to touch a single template or python script.
| >You can also have 'chains' of validators, which
| >makes it a snap to have highly-reusable validation. Of course there's
| >much more to it, but this is just to give an idea.
|
| A validation machinery is missing in CMF. But I don't think that
| justifies adding CMFFormController.
I have to disagree with you, unfortunately.
--
Sidnei da Silva <sidnei at awkly.org>
http://awkly.org - dreamcatching :: making your dreams come true
http://plone.org/about/team#dreamcatcher
You can be replaced by this computer.
More information about the Zope-CMF
mailing list