[Zope-CMF] Re: [dev] refactoring listFilteredActionsFor: a proposal
Sidnei da Silva
sidnei at awkly.org
Mon Nov 17 07:59:34 EST 2003
| >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.
|
| The results should be exactly the same.
Great!
| >| 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.
|
| If I find an easy solution I'll add a warning.
I think that raising a KeyError wouldn't be a bad idea :)
| >| 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>
|
| Oops! Should have explained this.
|
| I'd like to use getActionInfo for redirects instead of getActionById.
| In this use case action_chain would provide a fallback chain, e.g.
| <code>
| action_chain = ('object/edit', 'object/view')
| ti = context.getTypeInfo()
| target = ti.getActionInfo(context, action_chain)['url']
| context.REQUEST.RESPONSE.redirect(target)
| </code>
| would redirect to 'object/edit' if the action exists and the user has a
| permission and the condition is true (I guess check_visibility should
| better default to 0 in getActionInfo). If not, this code tries to
| redirect to 'object/view'.
|
| In listActionInfos action_chain is used by getActionInfo. An other use
| case would be pre-selecting actions and their order.
Yay! That sounds very good. +1 for that.
--
Sidnei da Silva <sidnei at awkly.org>
http://awkly.org - dreamcatching :: making your dreams come true
http://plone.org/about/team#dreamcatcher
Debian is like Suse with yast turned off, just better. :)
-- Goswin Brederlow
More information about the Zope-CMF
mailing list