[Catalyst-commits] r8096 -
Catalyst-Controller-DBIC-API/1.000/trunk/lib/Catalyst/Controller/DBIC/API
jshirley at dev.catalyst.perl.org
jshirley at dev.catalyst.perl.org
Wed Jul 9 19:49:38 BST 2008
Author: jshirley
Date: 2008-07-09 19:49:38 +0100 (Wed, 09 Jul 2008)
New Revision: 8096
Modified:
Catalyst-Controller-DBIC-API/1.000/trunk/lib/Catalyst/Controller/DBIC/API/Base.pm
Log:
Patch to honor a controller setting the status code
Modified: Catalyst-Controller-DBIC-API/1.000/trunk/lib/Catalyst/Controller/DBIC/API/Base.pm
===================================================================
--- Catalyst-Controller-DBIC-API/1.000/trunk/lib/Catalyst/Controller/DBIC/API/Base.pm 2008-07-09 18:18:00 UTC (rev 8095)
+++ Catalyst-Controller-DBIC-API/1.000/trunk/lib/Catalyst/Controller/DBIC/API/Base.pm 2008-07-09 18:49:38 UTC (rev 8096)
@@ -30,6 +30,7 @@
my ($self, $c) = @_;
my $req_params = (grep { ref $_ } values %{$c->req->params}) ? $c->req->params : $self->expand_hash($c->req->params);
+
my $source = $c->stash->{$self->rs_stash_key}->result_source;
my @columns = (scalar(@{$self->list_returns})) ? @{$self->list_returns} : ();
@@ -217,7 +218,13 @@
# check for errors
my $default_status;
- if ($self->get_errors($c)) {
+
+ # Check for errors caught elsewhere
+ if ( $c->res->status and $c->res->status != 200 ) {
+ $default_status = $c->res->status;
+ $c->stash->{response}->{success} = 'false';
+ }
+ elsif ($self->get_errors($c)) {
$c->stash->{response}->{messages} = $self->get_errors($c);
$c->stash->{response}->{success} = 'false';
$default_status = 400;
More information about the Catalyst-commits
mailing list