Skip to content

Commit d549823

Browse files
author
Andrey Lebedev
committed
more proper multilink sorting/grouping
1 parent c65ffbb commit d549823

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

CHANGES.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ are given with the most recent entry first.
2727
convered to GMT (see doc/upgrading.txt).
2828
- added a form to show a specific issue
2929
- fixed layout issues with forms in sidebar
30-
30+
- more proper sorting/grouping on mulitilink properties. Sorting is performed
31+
not only by number of links, but also by links itself. This makes usable
32+
grouping e.g. by topic multilink
3133

3234
2003-??-?? 0.5.5
3335
- fixed rdbms searching by ID (sf bug 666615)

roundup/backends/back_anydbm.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.98 2003-01-21 23:44:27 richard Exp $
18+
#$Id: back_anydbm.py,v 1.99 2003-02-03 11:14:16 kedder Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in a database
2121
chosen by anydbm. It is guaranteed to always be available in python
@@ -1760,12 +1760,15 @@ def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
17601760
# Multilink properties are sorted according to how many
17611761
# links are present.
17621762
elif isinstance(propclass, Multilink):
1763+
r = cmp(len(av), len(bv))
1764+
if r == 0:
1765+
# Compare contents of multilink property if lenghts is
1766+
# equal
1767+
r = cmp ('.'.join(av), '.'.join(bv))
17631768
if dir == '+':
1764-
r = cmp(len(av), len(bv))
1765-
if r != 0: return r
1769+
return r
17661770
elif dir == '-':
1767-
r = cmp(len(bv), len(av))
1768-
if r != 0: return r
1771+
return -r
17691772
elif isinstance(propclass, Number) or isinstance(propclass, Boolean):
17701773
if dir == '+':
17711774
r = cmp(av, bv)

0 commit comments

Comments
 (0)