Skip to content

Commit a730477

Browse files
author
Richard Jones
committed
better CGI text searching - but hidden filter fields are disappearing...
1 parent 93bd71d commit a730477

File tree

4 files changed

+46
-31
lines changed

4 files changed

+46
-31
lines changed

CHANGES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ This file contains the changes to the Roundup system over time. The entries
22
are given with the most recent entry first.
33

44
2001-xx-xx - 0.2.7
5+
Feature:
6+
. Text searches are now case insensitive. All forms of text search use
7+
regular expressions now.
8+
59
Fixed:
610
. Had another 2.1-ism in the unit tests
711
. Made the mail parser a little more robust w.r.t missing Subject:

README.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ cgi_client
105105
date:
106106
. date subtraction doesn't work correctly "if the dates cross leap years,
107107
phases of the moon, ..."
108+
cgi:
109+
. setting an issue to resolved, and no other changes, results in a change
110+
message with no indication of what changed
111+
. enabling a filter disables the current filter hidden fields...
108112

109113

110114
6. Author

roundup/htmltemplate.py

Lines changed: 29 additions & 25 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: htmltemplate.py,v 1.20 2001-08-15 23:43:18 richard Exp $
18+
# $Id: htmltemplate.py,v 1.21 2001-08-16 07:34:59 richard Exp $
1919

2020
import os, re, StringIO, urllib, cgi, errno
2121

@@ -505,18 +505,18 @@ def index(client, templates, db, classname, filterspec={}, filter=[],
505505
columns = l
506506

507507
# now display the index section
508-
w('<table width=100% border=0 cellspacing=0 cellpadding=2>')
509-
w('<tr class="list-header">')
508+
w('<table width=100% border=0 cellspacing=0 cellpadding=2>\n')
509+
w('<tr class="list-header">\n')
510510
for name in columns:
511511
cname = name.capitalize()
512512
if show_display_form:
513513
anchor = "%s?%s"%(classname, sortby(name, columns, filter,
514514
sort, group, filterspec))
515-
w('<td><span class="list-item"><a href="%s">%s</a></span></td>'%(
515+
w('<td><span class="list-item"><a href="%s">%s</a></span></td>\n'%(
516516
anchor, cname))
517517
else:
518-
w('<td><span class="list-item">%s</span></td>'%cname)
519-
w('</tr>')
518+
w('<td><span class="list-item">%s</span></td>\n'%cname)
519+
w('</tr>\n')
520520

521521
# this stuff is used for group headings - optimise the group names
522522
old_group = None
@@ -575,66 +575,66 @@ def index(client, templates, db, classname, filterspec={}, filter=[],
575575

576576
# now add in the filter/columns/group/etc config table form
577577
w('<p>')
578-
w('<table width=100% border=0 cellspacing=0 cellpadding=2>')
578+
w('<table width=100% border=0 cellspacing=0 cellpadding=2>\n')
579579
names = []
580580
for name in cl.getprops().keys():
581581
if name in all_filters or name in all_columns:
582582
names.append(name)
583583
w('<tr class="location-bar">')
584-
w('<th align="left" colspan=%s>View customisation...</th></tr>'%
584+
w('<th align="left" colspan=%s>View customisation...</th></tr>\n'%
585585
(len(names)+1))
586586
w('<tr class="location-bar"><th>&nbsp;</th>')
587587
for name in names:
588588
w('<th>%s</th>'%name.capitalize())
589-
w('</tr>')
589+
w('</tr>\n')
590590

591591
# filter
592592
if all_filters:
593-
w('<tr><th width="1%" align=right class="location-bar">Filters</th>')
593+
w('<tr><th width="1%" align=right class="location-bar">Filters</th>\n')
594594
for name in names:
595595
if name not in all_filters:
596596
w('<td>&nbsp;</td>')
597597
continue
598598
if name in filter: checked=' checked'
599599
else: checked=''
600-
w('<td align=middle>')
601-
w('<input type="checkbox" name=":filter" value="%s" %s></td>'%(name,
602-
checked))
603-
w('</tr>')
600+
w('<td align=middle>\n')
601+
w(' <input type="checkbox" name=":filter" value="%s" %s></td>\n'%(
602+
name, checked))
603+
w('</tr>\n')
604604

605605
# columns
606606
if all_columns:
607-
w('<tr><th width="1%" align=right class="location-bar">Columns</th>')
607+
w('<tr><th width="1%" align=right class="location-bar">Columns</th>\n')
608608
for name in names:
609609
if name not in all_columns:
610610
w('<td>&nbsp;</td>')
611611
continue
612612
if name in columns: checked=' checked'
613613
else: checked=''
614-
w('<td align=middle>')
615-
w('<input type="checkbox" name=":columns" value="%s" %s></td>'%(
614+
w('<td align=middle>\n')
615+
w(' <input type="checkbox" name=":columns" value="%s" %s></td>\n'%(
616616
name, checked))
617-
w('</tr>')
617+
w('</tr>\n')
618618

619619
# group
620-
w('<tr><th width="1%" align=right class="location-bar">Grouping</th>')
620+
w('<tr><th width="1%" align=right class="location-bar">Grouping</th>\n')
621621
for name in names:
622622
prop = properties[name]
623623
if name not in all_columns:
624624
w('<td>&nbsp;</td>')
625625
continue
626626
if name in group: checked=' checked'
627627
else: checked=''
628-
w('<td align=middle>')
629-
w('<input type="checkbox" name=":group" value="%s" %s></td>'%(
628+
w('<td align=middle>\n')
629+
w(' <input type="checkbox" name=":group" value="%s" %s></td>\n'%(
630630
name, checked))
631-
w('</tr>')
631+
w('</tr>\n')
632632

633633
w('<tr class="location-bar"><td width="1%">&nbsp;</td>')
634634
w('<td colspan="%s">'%len(names))
635-
w('<input type="submit" value="Redisplay"></td></tr>')
636-
w('</table>')
637-
w('</form>')
635+
w('<input type="submit" value="Redisplay"></td></tr>\n')
636+
w('</table>\n')
637+
w('</form>\n')
638638

639639

640640
#
@@ -742,6 +742,10 @@ def newitem(client, templates, db, classname, form, replace=re.compile(
742742

743743
#
744744
# $Log: not supported by cvs2svn $
745+
# Revision 1.20 2001/08/15 23:43:18 richard
746+
# Fixed some isFooTypes that I missed.
747+
# Refactored some code in the CGI code.
748+
#
745749
# Revision 1.19 2001/08/12 06:32:36 richard
746750
# using isinstance(blah, Foo) now instead of isFooType
747751
#

roundup/hyperdb.py

Lines changed: 9 additions & 6 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.17 2001-08-16 06:59:58 richard Exp $
18+
# $Id: hyperdb.py,v 1.18 2001-08-16 07:34:59 richard Exp $
1919

2020
# standard python modules
2121
import cPickle, re, string
@@ -567,11 +567,11 @@ def filter(self, filterspec, sort, group, num_re = re.compile('^\d+$')):
567567
u.append(entry)
568568
l.append((1, k, u))
569569
elif isinstance(propclass, String):
570-
if '*' in v or '?' in v:
571-
# simple glob searching
572-
v = v.replace('?', '.')
573-
v = v.replace('*', '.*?')
574-
l.append((2, k, re.compile(v, re.I)))
570+
# simple glob searching
571+
v = re.sub(r'([\|\{\}\\\.\+\[\]\(\)])', r'\\\1', v)
572+
v = v.replace('?', '.')
573+
v = v.replace('*', '.*?')
574+
l.append((2, k, re.compile(v, re.I)))
575575
else:
576576
l.append((6, k, v))
577577
filterspec = l
@@ -794,6 +794,9 @@ def Choice(name, *options):
794794

795795
#
796796
# $Log: not supported by cvs2svn $
797+
# Revision 1.17 2001/08/16 06:59:58 richard
798+
# all searches use re now - and they're all case insensitive
799+
#
797800
# Revision 1.16 2001/08/15 23:43:18 richard
798801
# Fixed some isFooTypes that I missed.
799802
# Refactored some code in the CGI code.

0 commit comments

Comments
 (0)