[Zope-CMF] Re: [dev] type actions, views and aliases: a proposal

Yuppie schubbe@web.de
Wed, 25 Jun 2003 13:55:14 +0200


Hi Florent,

thanks for the feedback!


Florent Guillaume wrote:
[...]
> Basically what you're having is, for each Action, a new property
> associated to it, let's call it traversal_alias. I would want this new
> field to be present in the Actions in the types tool, which is its
> natural place.

Well. I considered that, but I doubt it's its natural place. Method 
Aliases and Actions are related, but they are not the same.

> I must say I've not followed that closely the refactoring of the
> Actions, and the semantics now associated to the actions field of an
> Action. Would you mind doing a short writeup of these semantics ?

No need:

> The way I understand them is:
> 
>  - the actions field is a full contextual URL, destined to the UI,

Yes.

>  - because _getViewFor and getActionById are used to find a method, they
>    have to extract it from the above URL using a hack (passing a
>    context-less expression-context, with an empty object_url and then
>    stripping resulting the initial slash).

Correct. The current implementation of this hack fails with some 
expressions, so the use of expressions in type actions is limited.

> If that's how it works, that's good for backward compat, but in CMF 1.5
> I'd like to see:
> 
>  - an actions field that gets an URL,
>  - a method field that gets a method name (suitable for restrictedTraverse),
>  - and, to implement your proposal, a traverse_alias field.

Yes. The only difference of opinion is where these fiels should be.

[...]
> Note that there are other things I'd like to be able to add to Actions,
> for instance an icon name, an i18n msgid, etc.

All these properties are related to UI usage. All these properties are 
needed to create an actions box (or something like that) in a template.

Method Aliases are used on traversal. Method Aliases lookup should be 
fast, we can't resolve Action Expressions on each traversal step.

There are Actions that are not related to a Method. There are Methods 
that are not related to an Action. One Method Alias can be used in many 
Actions, there can be many aliases for one Method used in an Action.


I put the merge on hold until this is discussed. But maybe you want to 
checkout the current implementation from the branch. (Of course Method 
Aliases need a configuration tab for each TypeInfo, but I'll not add 
that before we agree about the basics.)


Cheers,

Yuppie