[Zope-CMF] [dev] refactoring listFilteredActionsFor: a proposal
Sidnei da Silva
sidnei at awkly.org
Mon Nov 17 06:55:13 EST 2003
| Details / Proposal:
|
|
| 1.)
| Actions are filtered on visibility, permissions and condition.
| Currently we have this order:
| - filter on condition
| - evaluate action Expression
| - filter on visibility
| - filter on permissions
|
| I propose this order:
| - filter on visibility (least expensive)
| - filter on permissions
| - filter on condition (most expensive)
| - evaluate action Expression
|
| This speeds up listFilteredActionsFor significantly.
Sounds good to me. I don't think it will cause significant difference
on the results to break existing apps, but correct me if I'm wrong.
| 2.)
| Action ids aren't unique.
| I propose to identify actions by a path '<category>/<id>', e.g.:
| 'object/edit', 'object/folderContents', 'folder/folderContents'
|
| It's not enforced these paths are unique, but duplicates are ignored.
+1, and it would be good to have some kind of warning when they are ignored.
| 3.)
| Action Providers should have a method that filters Actions. To avoid
| redundant code, listFilteredActionsFor could use this new method instead
| of listActions. The function of listFilteredActionsFor would not be
| filtering actions anymore, but aggregating actions from different
| sources and bucketing them into categories.
|
| I propose to add these methods to the ActionProvider Interface:
|
| def listActionInfos(action_chain=None, object=None, ec=None,
| max=999, check_visibility=1,
| check_permissions=1, check_condition=1):
| """ List Action info mappings.
|
| Permission -- Python only
|
| Returns -- Tuple of Action info mappings
| """
|
| def getActionInfo(action_chain, object=None, check_visibility=1):
| """ Get an Action info mapping specified by a chain of actions.
|
| Permission -- Always available
|
| Returns -- Action info mapping or None
| """
Looks good, though I don't know what the action_chain parameter is for <wink>
--
Sidnei da Silva <sidnei at awkly.org>
http://awkly.org - dreamcatching :: making your dreams come true
http://plone.org/about/team#dreamcatcher
Thrashing is just virtual crashing.
More information about the Zope-CMF
mailing list