Skip to content

Commit 7a1eea0

Browse files
author
Richard Jones
committed
merge from HEAD
1 parent 8e7957c commit 7a1eea0

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Fixed:
1717
- issue search page allows setting of no sorting / grouping (sf bug
1818
1119475)
1919
- better edit conflict handling (sf bug 1118790)
20+
- consistent text searching behaviour (AND everywhere) (sf bug 1101036)
2021

2122

2223
2005-01-13 0.8.0b2

roundup/backends/back_anydbm.py

Lines changed: 2 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.179.2.3 2005-01-06 17:59:38 a1s Exp $
18+
#$Id: back_anydbm.py,v 1.179.2.4 2005-02-13 22:40:53 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
@@ -1612,15 +1612,12 @@ def filter(self, search_matches, filterspec, sort=(None,None),
16121612
elif isinstance(propclass, hyperdb.String) and k != 'id':
16131613
if type(v) is not type([]):
16141614
v = [v]
1615-
m = []
16161615
for v in v:
16171616
# simple glob searching
16181617
v = re.sub(r'([\|\{\}\\\.\+\[\]\(\)])', r'\\\1', v)
16191618
v = v.replace('?', '.')
16201619
v = v.replace('*', '.*?')
1621-
m.append(v)
1622-
m = re.compile('(%s)'%('|'.join(m)), re.I)
1623-
l.append((STRING, k, m))
1620+
l.append((STRING, k, re.compile(v, re.I)))
16241621
elif isinstance(propclass, hyperdb.Date):
16251622
try:
16261623
date_rng = date.Range(v, date.Date, offset=timezone)

roundup/backends/back_metakit.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: back_metakit.py,v 1.88 2004-10-24 10:44:49 a1s Exp $
1+
# $Id: back_metakit.py,v 1.88.2.1 2005-02-13 22:40:53 richard Exp $
22
'''Metakit backend for Roundup, originally by Gordon McMillan.
33
44
Known Current Bugs:
@@ -1212,7 +1212,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
12121212
where = {'_isdel':0}
12131213
wherehigh = {}
12141214
mlcriteria = {}
1215-
regexes = {}
1215+
regexes = []
12161216
orcriteria = {}
12171217
for propname, value in filterspec.items():
12181218
prop = self.ruprops.get(propname, None)
@@ -1258,14 +1258,12 @@ def filter(self, search_matches, filterspec, sort=(None,None),
12581258
elif isinstance(prop, hyperdb.String):
12591259
if type(value) is not type([]):
12601260
value = [value]
1261-
m = []
12621261
for v in value:
12631262
# simple glob searching
12641263
v = re.sub(r'([\|\{\}\\\.\+\[\]\(\)])', r'\\\1', v)
12651264
v = v.replace('?', '.')
12661265
v = v.replace('*', '.*?')
1267-
m.append(v)
1268-
regexes[propname] = re.compile('(%s)'%('|'.join(m)), re.I)
1266+
regexes.append((propname, re.compile(v, re.I)))
12691267
elif propname == 'id':
12701268
where[propname] = int(value)
12711269
elif isinstance(prop, hyperdb.Boolean):
@@ -1353,7 +1351,7 @@ def ff(row, crit=orcriteria):
13531351

13541352
if regexes:
13551353
def ff(row, r=regexes):
1356-
for propname, regex in r.items():
1354+
for propname, regex in r:
13571355
val = str(getattr(row, propname))
13581356
if not regex.search(val):
13591357
return 0

roundup/backends/back_mysql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
572572

573573
# now add to the where clause
574574
where.append('('
575-
+' or '.join(["_%s._%s LIKE '%s'"%(cn, k, s) for s in v])
575+
+' and '.join(["_%s._%s LIKE '%s'"%(cn, k, s) for s in v])
576576
+')')
577577
# note: args are embedded in the query string now
578578
elif isinstance(propclass, Link):

roundup/backends/rdbms_common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: rdbms_common.py,v 1.142.2.3 2005-01-13 05:05:12 richard Exp $
1+
# $Id: rdbms_common.py,v 1.142.2.4 2005-02-13 22:40:53 richard Exp $
22
''' Relational database (SQL) backend common code.
33
44
Basics:
@@ -2100,7 +2100,7 @@ def filter(self, search_matches, filterspec, sort=(None,None),
21002100

21012101
# now add to the where clause
21022102
where.append('('
2103-
+' or '.join(["_%s._%s LIKE '%s'"%(cn, k, s) for s in v])
2103+
+' and '.join(["_%s._%s LIKE '%s'"%(cn, k, s) for s in v])
21042104
+')')
21052105
# note: args are embedded in the query string now
21062106
elif isinstance(propclass, Link):

test/db_test_base.py

Lines changed: 6 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: db_test_base.py,v 1.55.2.2 2005-01-04 01:33:04 richard Exp $
18+
# $Id: db_test_base.py,v 1.55.2.3 2005-02-13 22:40:53 richard Exp $
1919

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

@@ -920,10 +920,14 @@ def testFilteringNumber(self):
920920
def testFilteringString(self):
921921
ae, filt = self.filteringSetup()
922922
ae(filt(None, {'title': ['one']}, ('+','id'), (None,None)), ['1'])
923+
ae(filt(None, {'title': ['issue one']}, ('+','id'), (None,None)),
924+
['1'])
925+
ae(filt(None, {'title': ['issue', 'one']}, ('+','id'), (None,None)),
926+
['1'])
923927
ae(filt(None, {'title': ['issue']}, ('+','id'), (None,None)),
924928
['1','2','3'])
925929
ae(filt(None, {'title': ['one', 'two']}, ('+','id'), (None,None)),
926-
['1', '2'])
930+
[])
927931

928932
def testFilteringLink(self):
929933
ae, filt = self.filteringSetup()

0 commit comments

Comments
 (0)