[Catalyst-commits] r8361 -
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Fri Sep 5 22:33:25 BST 2008
Author: karpet
Date: 2008-09-05 22:33:25 +0100 (Fri, 05 Sep 2008)
New Revision: 8361
Modified:
CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm
Log:
always use $c->req->params
Modified: CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm 2008-09-05 18:55:52 UTC (rev 8360)
+++ CatalystX-CRUD/CatalystX-CRUD/trunk/lib/CatalystX/CRUD/Model/Utils.pm 2008-09-05 21:33:25 UTC (rev 8361)
@@ -124,18 +124,20 @@
}
sub make_sql_query {
- my $self = shift;
- my $c = $self->context;
- my $field_names = shift
+ my $self = shift;
+ my $c = $self->context;
+ my $field_names
+ = shift
|| $c->controller->field_names($c)
|| $self->throw_error("field_names required");
- my $p2q = $self->params_to_sql_query($field_names);
- my $params = $c->req->params;
- my $sp = Sort::SQL->string2array( $self->_which_sort($c) );
- my $s = join( ' ', map {%$_} @$sp );
- my $offset = $params->{'cxc-offset'} || $params->{'_offset'};
- my $page_size = $params->{'cxc-page_size'}
+ my $p2q = $self->params_to_sql_query($field_names);
+ my $params = $c->req->params;
+ my $sp = Sort::SQL->string2array( $self->_which_sort($c) );
+ my $s = join( ' ', map {%$_} @$sp );
+ my $offset = $params->{'cxc-offset'} || $params->{'_offset'};
+ my $page_size
+ = $params->{'cxc-page_size'}
|| $params->{'_page_size'}
|| $c->controller->page_size
|| $self->page_size;
@@ -232,8 +234,8 @@
for my $p (@$field_names) {
- next unless exists $c->req->params->{$p};
- my @v = $c->req->param($p);
+ next unless exists $params->{$p};
+ my @v = ref $params->{$p} ? @{ $params->{$p} } : ( $params->{$p} );
next unless grep { defined && m/./ } @v;
my @copy = @v;
$query{$p} = \@v;
More information about the Catalyst-commits
mailing list