Skip to content

Commit 278be8c

Browse files
author
Richard Jones
committed
merge from HEAD
1 parent 79dc2ed commit 278be8c

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Fixed:
1111
- fix some column datatypes in postgresql and mysql (sf bugs 962611,
1212
959177 and 964231)
1313
- fixed RDBMS journal packing (sf bug 959177)
14+
- fixed filtering by floats in anydbm (sf bug 963584)
1415

1516

1617
2004-05-28 0.7.3

roundup/backends/back_anydbm.py

Lines changed: 2 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: back_anydbm.py,v 1.146.2.4 2004-06-08 05:34:21 richard Exp $
18+
#$Id: back_anydbm.py,v 1.146.2.5 2004-06-09 06:37:22 richard Exp $
1919
'''This module defines a backend that saves the hyperdatabase in a
2020
database chosen by anydbm. It is guaranteed to always be available in python
2121
versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -1656,7 +1656,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
16561656
bv = v
16571657
l.append((OTHER, k, bv))
16581658
elif isinstance(propclass, Number):
1659-
l.append((OTHER, k, int(v)))
1659+
l.append((OTHER, k, float(v)))
16601660
else:
16611661
l.append((OTHER, k, v))
16621662
filterspec = l

test/db_test_base.py

Lines changed: 11 additions & 4 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.27.2.2 2004-06-08 05:35:44 richard Exp $
18+
# $Id: db_test_base.py,v 1.27.2.3 2004-06-09 06:37:22 richard Exp $
1919

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

@@ -813,9 +813,9 @@ def testStringFind(self):
813813

814814
def filteringSetup(self):
815815
for user in (
816-
{'username': 'bleep'},
817-
{'username': 'blop'},
818-
{'username': 'blorp'}):
816+
{'username': 'bleep', 'age': 1},
817+
{'username': 'blop', 'age': 1.5},
818+
{'username': 'blorp', 'age': 2}):
819819
self.db.user.create(**user)
820820
iss = self.db.issue
821821
for issue in (
@@ -840,6 +840,13 @@ def testFilteringID(self):
840840
ae(filt(None, {'id': '2'}, ('+','id'), (None,None)), ['2'])
841841
ae(filt(None, {'id': '10'}, ('+','id'), (None,None)), [])
842842

843+
def testFilteringNumber(self):
844+
self.filteringSetup()
845+
ae, filt = self.assertEqual, self.db.user.filter
846+
ae(filt(None, {'age': '1'}, ('+','id'), (None,None)), ['3'])
847+
ae(filt(None, {'age': '1.5'}, ('+','id'), (None,None)), ['4'])
848+
ae(filt(None, {'age': '2'}, ('+','id'), (None,None)), ['5'])
849+
843850
def testFilteringString(self):
844851
ae, filt = self.filteringSetup()
845852
ae(filt(None, {'title': ['one']}, ('+','id'), (None,None)), ['1'])

0 commit comments

Comments
 (0)