[Zope-CMF] Re: [dev] refactoring listFilteredActionsFor: a proposal
Yuppie
schubbe at web.de
Mon Nov 17 09:23:34 EST 2003
Hi!
Sidnei da Silva wrote:
> | >| 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 :)
I did think about this again:
a.) All we need to identify Actions are unique paths per Action
Provider. A global identifier would be something like
'portal_membership/actions/user/login' or
'portal_types/Document/actions/object/view'. We could even make them
accessible by URLs, but that is not part of the proposal.
b.) Most sites should already follow the rule to define an id only once
per Action Provider and category. If we want to enforce that, methods
like addAction should raise an error.
c.) All I need for my proposal is that people agree the use of
duplicates is deprecated so it is save to ignore duplicates if the
action_chain argument is specified.
If action_chain is specified, the code would only look for the first
match. Looking for duplicates just to issue a warning doesn't make sense
to me.
If action_chain is not specified, finding duplicates would need extra
code. In this case I'd prefer to ignore the fact there might be
duplicates. This makes listFilteredActionsFor 100% backwards compatible.
Cheers,
Yuppie
More information about the Zope-CMF
mailing list