Mercurial > p > roundup > code
changeset 2601:113548baeed2
API clarification.
Previously, the anydbm/bsddb/metakit filter() methods had required
exact matches to Multilink argument lists. The RDBMS backends treated
Multilink matches like all other data types - matching any of the
Multilink argument list is good enough. The latter behaviour is
implemented across the board now.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 20 Jul 2004 22:56:18 +0000 |
| parents | f25ff5a05abd |
| children | a32349bfcde4 |
| files | CHANGES.txt roundup/backends/back_anydbm.py roundup/backends/back_metakit.py test/db_test_base.py |
| diffstat | 4 files changed, 19 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Tue Jul 20 07:26:40 2004 +0000 +++ b/CHANGES.txt Tue Jul 20 22:56:18 2004 +0000 @@ -33,6 +33,11 @@ - document the STATIC_FILES config var - implement the HTTP HEAD command (sf bug 992544) - fix journal export of files to remove content from CSV files +- API clarification. Previously, the anydbm/bsddb/metakit filter() methods + had required exact matches to Multilink argument lists. The RDBMS + backends treated Multilink matches like all other data types - matching + any of the Multilink argument list is good enough. The latter behaviour + is implemented across the board now. 2004-06-24 0.7.5
--- a/roundup/backends/back_anydbm.py Tue Jul 20 07:26:40 2004 +0000 +++ b/roundup/backends/back_anydbm.py Tue Jul 20 22:56:18 2004 +0000 @@ -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.162 2004-07-20 07:26:40 richard Exp $ +#$Id: back_anydbm.py,v 1.163 2004-07-20 22:56:18 richard 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 versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several @@ -1536,9 +1536,7 @@ The filter must match all properties specificed - but if the property value to match is a list, any one of the values in the - list may match for that property to match. Unless the property - is a Multilink, in which case the item's property list must - match the filterspec list. + list may match for that property to match. """ if __debug__: start_t = time.time() @@ -1666,10 +1664,9 @@ # othewise, make sure this node has each of the # required values for want in v: - if want not in nv: + if want in nv: + match = True break - else: - match = True elif t == STRING: if nv is None: nv = ''
--- a/roundup/backends/back_metakit.py Tue Jul 20 07:26:40 2004 +0000 +++ b/roundup/backends/back_metakit.py Tue Jul 20 22:56:18 2004 +0000 @@ -1,4 +1,4 @@ -# $Id: back_metakit.py,v 1.79 2004-07-20 05:58:07 richard Exp $ +# $Id: back_metakit.py,v 1.80 2004-07-20 22:56:18 richard Exp $ '''Metakit backend for Roundup, originally by Gordon McMillan. Known Current Bugs: @@ -1313,12 +1313,12 @@ def ff(row, ml=mlcriteria): for propname, values in ml.items(): sv = getattr(row, propname) - if not values and sv: - return 0 + if not values and not sv: + return 1 for id in values: - if sv.find(fid=id) == -1: - return 0 - return 1 + if sv.find(fid=id) != -1: + return 1 + return 0 iv = v.filter(ff) v = v.remapwith(iv)
--- a/test/db_test_base.py Tue Jul 20 07:26:40 2004 +0000 +++ b/test/db_test_base.py Tue Jul 20 22:56:18 2004 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: db_test_base.py,v 1.39 2004-07-03 23:05:15 richard Exp $ +# $Id: db_test_base.py,v 1.40 2004-07-20 22:56:18 richard Exp $ import unittest, os, shutil, errno, imp, sys, time, pprint @@ -693,6 +693,7 @@ i1 = self.db.issue.create(files=[f1, f2]) self.db.commit() d = self.db.indexer.search(['hello'], self.db.issue) + self.assert_(d.has_key(i1)) d[i1]['files'].sort() self.assertEquals(d, {i1: {'files': [f1, f2]}}) self.assertEquals(self.db.indexer.search(['world'], self.db.issue), @@ -841,7 +842,7 @@ {'title': 'issue two', 'status': '1', 'assignedto': '2', 'foo': date.Interval('1d'), 'priority': '3', 'deadline': date.Date('2003-02-16.22:50')}, - {'title': 'issue three', 'status': '1', 'priority': '2', + {'title': 'issue three', 'status': '1', 'priority': '2', 'nosy': ['1','2'], 'deadline': date.Date('2003-02-18')}, {'title': 'non four', 'status': '3', 'foo': date.Interval('0:10'), 'priority': '2', @@ -894,7 +895,7 @@ ae(filt(None, {'nosy': '2'}, ('+','id'), (None,None)), ['3']) ae(filt(None, {'nosy': '-1'}, ('+','id'), (None,None)), ['1', '2']) ae(filt(None, {'nosy': ['1','2']}, ('+', 'status'), - ('-', 'activity')), ['4', '3']) + ('-', 'deadline')), ['4', '3']) def testFilteringMany(self): ae, filt = self.filteringSetup()
