[Zope-CMF] Re: [dev] refactoring listFilteredActionsFor: a proposal

Dieter Maurer dieter at handshake.de
Tue Nov 18 12:40:20 EST 2003


Yuppie wrote at 2003-11-18 09:51 +0100:
 > Dieter Maurer wrote:
 > > I may be an interesting use case to give different actions
 > > the same id but use them with different (disjoint) conditions.
 > ...

 > Regarding the use case you describe: Wouldn't it be sufficient to use 
 > different categories like we have for 'folderContents' in ActionsTool? 
 > You could use subcategories like 'globalCase1' and 'globalCase2'.

The categories control how the actions are used in the UI;
e.g. "user" there, "object" here, "folder" below, ...

When we use categories to work around non-unique ids, then
we make this essential use ("categorie <--> UI-place") more difficult.
But as the original use case (same id, different conditions) seems not
so essential ...

 > ...
 > > It may be a good idea to encapulate the filtering in its own
 > > function. I have an "ActionFolder" product (a hierarchically
 > > structured "ActionsProvider") that could benefit from such
 > > factorization.
 > 
 > The implementation I'm working on looks like this:
 > listActionInfos() encapsulates the filtering in a method. TypesTool is 
 > also a hierarchically structured ActionProvider. TypesTool and each 
 > TypeInfo inherit listActionInfos() from ActionProviderBase. The 
 > aggregation of the hierarchy is still done by listActions().
 > 
 > Could your 'ActionFolder' product benefit from a solution like that?

Yes, I think so.

 > BTW: Is 'ActionFolder' publicly available? Sounds interesting.

It has beeen developed during my paid work but I will ask...

 > ... max = 999 ...
 > The use case I had in mind for 'max' is returning only the first result. 
 > This is used in combination with 'action_chain'. It doesn't make much 
 > sense to evaluate the fallback actions if we found an action that passes 
 > the checks. Would a 'only_first' flag better than 'max'?

We can look how Python handles this case: e.g. "string.split", "re.sub".

  Along these line, "max" would be unlimited by default and when
  needed, a limited value can be specified.

-- 
Dieter



More information about the Zope-CMF mailing list