From: kedder Date: Mon, 3 Feb 2003 11:14:16 +0000 (+0000) Subject: more proper multilink sorting/grouping X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d7e90ae60e3488c1cf5b4ec69065c1e51015f935;p=roundup.git more proper multilink sorting/grouping git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1486 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/CHANGES.txt b/CHANGES.txt index b46ed5e..07990c7 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -27,7 +27,9 @@ are given with the most recent entry first. convered to GMT (see doc/upgrading.txt). - added a form to show a specific issue - fixed layout issues with forms in sidebar - +- more proper sorting/grouping on mulitilink properties. Sorting is performed + not only by number of links, but also by links itself. This makes usable + grouping e.g. by topic multilink 2003-??-?? 0.5.5 - fixed rdbms searching by ID (sf bug 666615) diff --git a/roundup/backends/back_anydbm.py b/roundup/backends/back_anydbm.py index 37c65b3..c106f2f 100644 --- a/roundup/backends/back_anydbm.py +++ b/roundup/backends/back_anydbm.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.98 2003-01-21 23:44:27 richard Exp $ +#$Id: back_anydbm.py,v 1.99 2003-02-03 11:14:16 kedder Exp $ ''' This module defines a backend that saves the hyperdatabase in a database chosen by anydbm. It is guaranteed to always be available in python @@ -1760,12 +1760,15 @@ class Class(hyperdb.Class): # Multilink properties are sorted according to how many # links are present. elif isinstance(propclass, Multilink): + r = cmp(len(av), len(bv)) + if r == 0: + # Compare contents of multilink property if lenghts is + # equal + r = cmp ('.'.join(av), '.'.join(bv)) if dir == '+': - r = cmp(len(av), len(bv)) - if r != 0: return r + return r elif dir == '-': - r = cmp(len(bv), len(av)) - if r != 0: return r + return -r elif isinstance(propclass, Number) or isinstance(propclass, Boolean): if dir == '+': r = cmp(av, bv)