[Catalyst-commits] r12470 - in
Catalyst-Controller-DBIC-API/1.004/trunk: .
lib/Catalyst/Controller/DBIC lib/Catalyst/Controller/DBIC/API
t/lib/RestTest/Controller/API/REST
abraxxa at dev.catalyst.perl.org
abraxxa at dev.catalyst.perl.org
Wed Dec 23 15:25:49 GMT 2009
Author: abraxxa
Date: 2009-12-23 15:25:48 +0000 (Wed, 23 Dec 2009)
New Revision: 12470
Modified:
Catalyst-Controller-DBIC-API/1.004/trunk/Changes
Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API.pm
Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API/RequestArguments.pm
Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API/StoredResultSource.pm
Catalyst-Controller-DBIC-API/1.004/trunk/t/lib/RestTest/Controller/API/REST/CD.pm
Log:
Fixed pod to not use the config attributes from before 1.004
started fixing prefetch_allows check to properly handle nested attrs + test, code which needs attention is marked with FIXME
Modified: Catalyst-Controller-DBIC-API/1.004/trunk/Changes
===================================================================
--- Catalyst-Controller-DBIC-API/1.004/trunk/Changes 2009-12-23 13:01:04 UTC (rev 12469)
+++ Catalyst-Controller-DBIC-API/1.004/trunk/Changes 2009-12-23 15:25:48 UTC (rev 12470)
@@ -1,5 +1,8 @@
Revision history for Catalyst-Controller-DBIC-API
+- Fixed pod to not use the config attributes from before 1.004
+- Fixed prefetch_allows check to properly handle nested attrs + test
+
1.004000
- Moosify
- Move validation for *_exposes/*_allows to Data::DPath::Validator
@@ -10,8 +13,8 @@
1.003004
- Database errors are also handled for searches + tests
-- totalcount isn't included in the response if a db error occurs while fetching data
-- converted no_plan tests to done_testing (required Test::More 0.88)
+- Totalcount isn't included in the response if a db error occurs while fetching data
+- Converted no_plan tests to done_testing (required Test::More 0.88)
1.003003
- Database errors are properly handled + test
Modified: Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API/RequestArguments.pm
===================================================================
--- Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API/RequestArguments.pm 2009-12-23 13:01:04 UTC (rev 12469)
+++ Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API/RequestArguments.pm 2009-12-23 15:25:48 UTC (rev 12470)
@@ -92,7 +92,7 @@
{
if(HashRef->check($pf))
{
- die qq|'${\Dumper($pf)}' is not an allowd prefetch in: ${\join("\n", @{$self->prefetch_validator->templates})}|
+ die qq|'${\Dumper($pf)}' is not an allowed prefetch in: ${\join("\n", @{$self->prefetch_validator->templates})}|
unless $self->prefetch_validator->validate($pf)->[0];
}
else
@@ -122,27 +122,32 @@
trigger => sub
{
my ($self, $new) = @_;
- foreach my $rel (@$new)
- {
+
+ sub check_rel {
+ my ($self, $rel, $static) = @_;
if(ArrayRef->check($rel))
{
foreach my $rel_sub (@$rel)
{
- $self->check_has_relation($rel_sub, undef, undef, $p->static);
- $self->prefetch_validator->load($rel_sub);
+ $self->check_rel($rel_sub, $static);
}
}
elsif(HashRef->check($rel))
{
- $self->check_has_relation(%$rel, undef, $p->static);
+ $self->check_has_relation(%$rel, undef, $static);
$self->prefetch_validator->load($rel);
}
else
{
- $self->check_has_relation($rel, undef, undef, $p->static);
+ $self->check_has_relation($rel, undef, undef, $static);
$self->prefetch_validator->load($rel);
}
}
+
+ foreach my $rel (@$new)
+ {
+ $self->check_rel($rel, $p->static);
+ }
},
traits => ['Aliased'],
alias => 'list_prefetch_allows',
Modified: Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API/StoredResultSource.pm
===================================================================
--- Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API/StoredResultSource.pm 2009-12-23 13:01:04 UTC (rev 12469)
+++ Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API/StoredResultSource.pm 2009-12-23 15:25:48 UTC (rev 12470)
@@ -51,6 +51,9 @@
{
my $rel_src = $nest->related_source($rel);
die "Relation '$rel_src' does not exist" if not defined($rel_src);
+ #FIXME
+ # %$foo expands to two args: $key, $value
+ # but just if the hash has only one key/value pair
return $self->check_has_relation(%$other, $rel_src, $static);
}
else
@@ -70,6 +73,9 @@
{
try
{
+ #FIXME
+ # %$foo expands to two args: $key, $value
+ # but just if the hash has only one key/value pair
$self->check_has_relation(%$col_rel, undef, $static);
}
catch
Modified: Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API.pm
===================================================================
--- Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API.pm 2009-12-23 13:01:04 UTC (rev 12469)
+++ Catalyst-Controller-DBIC-API/1.004/trunk/lib/Catalyst/Controller/DBIC/API.pm 2009-12-23 15:25:48 UTC (rev 12470)
@@ -133,7 +133,7 @@
and unwanted disclosure of data.
Every element of the arrayref is one allowed parameter to prefetch.
So for three searches, all requiring different prefetch parameters,
-three elements have to be passed to list_prefetch_allows in the controller.
+three elements have to be passed to prefetch_allows in the controller.
=head2 grouped_by
@@ -157,7 +157,7 @@
__PACKAGE__->config
( ...,
- list_search_exposes => [qw/position title custom_column/],
+ search_exposes => [qw/position title custom_column/],
);
and then in your custom resultset:
Modified: Catalyst-Controller-DBIC-API/1.004/trunk/t/lib/RestTest/Controller/API/REST/CD.pm
===================================================================
--- Catalyst-Controller-DBIC-API/1.004/trunk/t/lib/RestTest/Controller/API/REST/CD.pm 2009-12-23 13:01:04 UTC (rev 12469)
+++ Catalyst-Controller-DBIC-API/1.004/trunk/t/lib/RestTest/Controller/API/REST/CD.pm 2009-12-23 15:25:48 UTC (rev 12470)
@@ -9,7 +9,8 @@
( action => { setup => { PathPart => 'cd', Chained => '/api/rest/rest_base' } },
class => 'RestTestDB::CD',
create_requires => ['artist', 'title', 'year' ],
- update_allows => ['title', 'year']
+ update_allows => ['title', 'year'],
+ prefetch_allows => [['artist', ['tracks'], { cd_to_producer => ['producer'], tag => 'cd' }]],
);
1;
More information about the Catalyst-commits
mailing list