[Maypole-dev] [PATCH] Search fix

From: Dagfinn Ilmari Mannsåker (ilmari at ilmari.org)
Date: Sun Dec 05 2004 - 20:06:51 GMT


I don't know if this is an Apache2-ism, but when submitting the search
form, all the files are included in $r->{params}, even the empty ones.
So, when building the search, we need to include only the non-empty
ones. Here's a patch:

Index: lib/Maypole/Model/CDBI.pm
===================================================================
--- lib/Maypole/Model/CDBI.pm (revision 293)
+++ lib/Maypole/Model/CDBI.pm (working copy)
@@ -158,7 +158,7 @@
     my $oper = "like"; # For now
     my %params = %{ $r->{params} };
     my %values = map { $_ => { $oper, $params{$_} } }
- grep { defined $params{$_} and $fields{$_} } keys %params;
+ grep { length $params{$_} and $fields{$_} } keys %params;

     $r->template("list");
     if ( !%values ) { return $self->list($r) }

-- 
ilmari

_______________________________________________ maypole-dev mailing list maypole-dev at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole-dev



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT