Re: [Maypole-dev] [PATCH] Search fix

From: Simon Flack (sf at flacks.net)
Date: Sun Dec 05 2004 - 20:28:50 GMT


On Sun, 05 Dec 2004 21:06:51 +0100, Dagfinn Ilmari Mannsåker wrote
> 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

That looks reasonable, but what happens if you really do want to search where
the value for a column is an empty string or NULL?

--simonflk

_______________________________________________
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