Skip to content

Commit 42a1e2f

Browse files
author
Richard Jones
committed
Made Class.stringFind() do caseless matching.
1 parent 1b6e742 commit 42a1e2f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

roundup/hyperdb.py

Lines changed: 10 additions & 3 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.28 2001-10-21 04:44:50 richard Exp $
18+
# $Id: hyperdb.py,v 1.29 2001-10-27 00:17:41 richard Exp $
1919

2020
# standard python modules
2121
import cPickle, re, string
@@ -526,7 +526,8 @@ def find(self, **propspec):
526526
return l
527527

528528
def stringFind(self, **requirements):
529-
"""Locate a particular node by matching a set of its String properties.
529+
"""Locate a particular node by matching a set of its String
530+
properties in a caseless search.
530531
531532
If the property is not a String property, a TypeError is raised.
532533
@@ -536,14 +537,15 @@ def stringFind(self, **requirements):
536537
prop = self.properties[propname]
537538
if isinstance(not prop, String):
538539
raise TypeError, "'%s' not a String property"%propname
540+
requirements[propname] = requirements[propname].lower()
539541
l = []
540542
cldb = self.db.getclassdb(self.classname)
541543
for nodeid in self.db.getnodeids(self.classname, cldb):
542544
node = self.db.getnode(self.classname, nodeid, cldb)
543545
if node.has_key(self.db.RETIRED_FLAG):
544546
continue
545547
for key, value in requirements.items():
546-
if node[key] != value:
548+
if node[key].lower() != value:
547549
break
548550
else:
549551
l.append(nodeid)
@@ -847,6 +849,11 @@ def Choice(name, *options):
847849

848850
#
849851
# $Log: not supported by cvs2svn $
852+
# Revision 1.28 2001/10/21 04:44:50 richard
853+
# bug #473124: UI inconsistency with Link fields.
854+
# This also prompted me to fix a fairly long-standing usability issue -
855+
# that of being able to turn off certain filters.
856+
#
850857
# Revision 1.27 2001/10/20 23:44:27 richard
851858
# Hyperdatabase sorts strings-that-look-like-numbers as numbers now.
852859
#

0 commit comments

Comments
 (0)