From c784dbf065935968fd334499d6fbae150e304a5b Mon Sep 17 00:00:00 2001 From: stefan Date: Thu, 19 Feb 2009 20:03:10 +0000 Subject: [PATCH] Use canonical sort order for multilinks. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4142 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/cgi/form_parser.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/roundup/cgi/form_parser.py b/roundup/cgi/form_parser.py index ae7ef17..cf6bb25 100755 --- a/roundup/cgi/form_parser.py +++ b/roundup/cgi/form_parser.py @@ -425,7 +425,9 @@ class FormParser: if entry not in existing: existing.append(entry) value = existing - value.sort() + # Sort the value in the same order used by + # Multilink.from_raw. + value.sort(key = lambda x: int(x)) elif value == '': # other types should be None'd if there's no value @@ -483,9 +485,13 @@ class FormParser: except IndexError, message: raise FormError(str(message)) - # make sure the existing multilink is sorted + # make sure the existing multilink is sorted. We must + # be sure to use the same sort order in all places, + # since we want to compare values with "=" or "!=". + # The canonical order (given in Multilink.from_raw) is + # by the numeric value of the IDs. if isinstance(proptype, hyperdb.Multilink): - existing.sort() + existing.sort(key = lambda x: int(x)) # "missing" existing values may not be None if not existing: -- 2.30.2