Skip to content

Commit 04af3bd

Browse files
author
Ralf Schlatterbeck
committed
Fixes:
- Fixed StringSort test case to require case-insensitive sorting - Fixed hyperdb sort_repr for String to user lower() - Fixed SQL backends to sort by lower(string) -- only mysql sorts lowercase by default, so doing a special case for mysql didn't seem worth the effort.
1 parent 326e7aa commit 04af3bd

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

roundup/hyperdb.py

Lines changed: 4 additions & 2 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: hyperdb.py,v 1.124 2006-08-21 12:19:48 schlatterbeck Exp $
18+
# $Id: hyperdb.py,v 1.125 2006-08-22 19:33:02 schlatterbeck Exp $
1919

2020
"""Hyperdatabase implementation, especially field types.
2121
"""
@@ -56,9 +56,11 @@ def from_raw(self, value, **kw):
5656
"""fix the CRLF/CR -> LF stuff"""
5757
return fixNewlines(value)
5858
def sort_repr (self, cls, val, name):
59+
if not val:
60+
return val
5961
if name == 'id':
6062
return int(val)
61-
return val
63+
return val.lower()
6264

6365
class Password(_Type):
6466
"""An object designating a Password property."""

test/db_test_base.py

Lines changed: 3 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: db_test_base.py,v 1.75 2006-08-21 12:19:48 schlatterbeck Exp $
18+
# $Id: db_test_base.py,v 1.76 2006-08-22 19:33:02 schlatterbeck Exp $
1919

2020
import unittest, os, shutil, errno, imp, sys, time, pprint, sets
2121

@@ -1071,10 +1071,8 @@ def testFilteringStringSort(self):
10711071
# 3: 'Issue three'
10721072
# 4: 'non four'
10731073
self.db.issue.set('3', title='Issue three')
1074-
assert(filt(None, {}, ('+','title')) in
1075-
[['3', '1', '2', '4'], ['1', '3', '2', '4']])
1076-
assert(filt(None, {}, ('-','title')) in
1077-
[['4', '2', '1', '3'], ['4', '2', '3', '1']])
1074+
ae(filt(None, {}, ('+','title')), ['1', '3', '2', '4'])
1075+
ae(filt(None, {}, ('-','title')), ['4', '2', '3', '1'])
10781076
# Obscure bug in anydbm backend trying to convert to number
10791077
# 1: '1st issue'
10801078
# 2: '2'

0 commit comments

Comments
 (0)