[CMF-checkins] CVS: CMF/CMFCore - ActionsTool.py:1.26

Tres Seaver tseaver@zope.com
Sat, 9 Mar 2002 19:11:43 -0500 (EST)


On Sat, 9 Mar 2002, Chris Withers wrote:

> Update of /cvs-repository/CMF/CMFCore
> In directory cvs.zope.org:/tmp/cvs-serv7103/CMFCore
> 
> Modified Files:
> 	ActionsTool.py 
> Log Message:
> Fixed ActionsTool so that duplicate actions are stripped
> 
> === CMF/CMFCore/ActionsTool.py 1.25 => 1.26 ===
>                  if catlist is None:
>                      filtered_actions[category] = catlist = []
> -                # If a bug occurs where actions appear more than once,
> -                # a little code right here can fix it.
> -                catlist.append(action)
> +                # Filter out duplicate actions
> +                if not action in catlist:
> +                    catlist.append(action)

I don't think this does what you want -- it only filters based on
*identity* (the exact same object), rather than by *equivalence*
(I'm not sure what this would mean, but perhaps the combination of
title and URL?)  Your test passes the same action object twice in
succession; a better test would construct two "logically equivalent"
actions.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.org