Skip to content

Commit 93bd71d

Browse files
author
Richard Jones
committed
all searches use re now - and they're all case insensitive
1 parent 97757c6 commit 93bd71d

File tree

1 file changed

+15
-24
lines changed

1 file changed

+15
-24
lines changed

roundup/hyperdb.py

Lines changed: 15 additions & 24 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.16 2001-08-15 23:43:18 richard Exp $
18+
# $Id: hyperdb.py,v 1.17 2001-08-16 06:59:58 richard Exp $
1919

2020
# standard python modules
2121
import cPickle, re, string
@@ -571,20 +571,7 @@ def filter(self, filterspec, sort, group, num_re = re.compile('^\d+$')):
571571
# simple glob searching
572572
v = v.replace('?', '.')
573573
v = v.replace('*', '.*?')
574-
v = re.compile(v)
575-
l.append((2, k, v))
576-
elif v[0] == '^':
577-
# start-anchored
578-
if v[-1] == '$':
579-
# _and_ end-anchored
580-
l.append((6, k, v[1:-1]))
581-
l.append((3, k, v[1:]))
582-
elif v[-1] == '$':
583-
# end-anchored
584-
l.append((4, k, v[:-1]))
585-
else:
586-
# substring
587-
l.append((5, k, v))
574+
l.append((2, k, re.compile(v, re.I)))
588575
else:
589576
l.append((6, k, v))
590577
filterspec = l
@@ -615,15 +602,15 @@ def filter(self, filterspec, sort, group, num_re = re.compile('^\d+$')):
615602
elif t == 2 and not v.search(node[k]):
616603
# RE search
617604
break
618-
elif t == 3 and node[k][:len(v)] != v:
619-
# start anchored
620-
break
621-
elif t == 4 and node[k][-len(v):] != v:
622-
# end anchored
623-
break
624-
elif t == 5 and node[k].find(v) == -1:
625-
# substring search
626-
break
605+
# elif t == 3 and node[k][:len(v)] != v:
606+
# # start anchored
607+
# break
608+
# elif t == 4 and node[k][-len(v):] != v:
609+
# # end anchored
610+
# break
611+
# elif t == 5 and node[k].find(v) == -1:
612+
# # substring search
613+
# break
627614
elif t == 6 and node[k] != v:
628615
# straight value comparison for the other types
629616
break
@@ -807,6 +794,10 @@ def Choice(name, *options):
807794

808795
#
809796
# $Log: not supported by cvs2svn $
797+
# Revision 1.16 2001/08/15 23:43:18 richard
798+
# Fixed some isFooTypes that I missed.
799+
# Refactored some code in the CGI code.
800+
#
810801
# Revision 1.15 2001/08/12 06:32:36 richard
811802
# using isinstance(blah, Foo) now instead of isFooType
812803
#

0 commit comments

Comments
 (0)