Skip to content

Commit d18be1d

Browse files
author
Richard Jones
committed
fix to [SF#691071], really this time
1 parent 825a2f1 commit d18be1d

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

roundup/backends/back_anydbm.py

Lines changed: 16 additions & 14 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.96.2.2 2003-02-12 00:03:35 richard Exp $
18+
#$Id: back_anydbm.py,v 1.96.2.3 2003-03-10 00:22:52 richard 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
@@ -1703,13 +1703,14 @@ def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
17031703
if isinstance(propclass, Multilink): bv = []
17041704
else: bv = ''
17051705

1706-
# String and Date values are sorted in the natural way
17071706
if isinstance(propclass, String):
1707+
# String and Date values are sorted in the natural way
17081708
# clean up the strings
17091709
if av and av[0] in string.uppercase:
17101710
av = av.lower()
17111711
if bv and bv[0] in string.uppercase:
17121712
bv = bv.lower()
1713+
17131714
if (isinstance(propclass, String) or
17141715
isinstance(propclass, Date)):
17151716
# it might be a string that's really an integer
@@ -1725,11 +1726,11 @@ def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
17251726
r = cmp(bv, av)
17261727
if r != 0: return r
17271728

1728-
# Link properties are sorted according to the value of
1729-
# the "order" property on the linked nodes if it is
1730-
# present; or otherwise on the key string of the linked
1731-
# nodes; or finally on the node ids.
17321729
elif isinstance(propclass, Link):
1730+
# Link properties are sorted according to the value of
1731+
# the "order" property on the linked nodes if it is
1732+
# present; or otherwise on the key string of the linked
1733+
# nodes; or finally on the node ids.
17331734
link = db.classes[propclass.classname]
17341735
if av is None and bv is not None: return -1
17351736
if av is not None and bv is None: return 1
@@ -1759,21 +1760,22 @@ def sortfun(a, b, sort=sort, group=group, properties=self.getprops(),
17591760
r = cmp(bv, av)
17601761
if r != 0: return r
17611762

1762-
# Multilink properties are sorted according to how many
1763-
# links are present.
17641763
elif isinstance(propclass, Multilink):
1764+
# Multilink properties are sorted according to how many
1765+
# links are present.
17651766
if dir == '+':
17661767
r = cmp(len(av), len(bv))
1767-
if r != 0: return r
1768-
elif dir == '-':
1768+
else:
17691769
r = cmp(len(bv), len(av))
1770-
if r != 0: return r
1771-
elif isinstance(propclass, Number) or isinstance(propclass, Boolean):
1770+
if r != 0: return r
1771+
else:
1772+
# all other types just compare
17721773
if dir == '+':
17731774
r = cmp(av, bv)
1774-
elif dir == '-':
1775+
else:
17751776
r = cmp(bv, av)
1776-
1777+
if r != 0: return r
1778+
17771779
# end for dir, prop in sort, group:
17781780
# if all else fails, compare the ids
17791781
return cmp(a[0], b[0])

0 commit comments

Comments
 (0)