| CODENOTIFIER | HelpYou are not signed inSign in |
Project: Catalyst
Revision: 8356
Author: karpet
Date: 05 Sep 2008 00:44:06
Changes:check for $c->res->location before redirecting in postcommit()
Files:| ... | ...@@ -386,14 +386,18 @@ | |
| 386 | 386 | my ( $self, $c, $o ) = @_; |
| 387 | 387 | my $id = $self->make_primary_key_string($o); |
| 388 | 388 | |
| 389 | if ( $c->action->name eq 'rm' ) { | |
| 390 | $c->response->redirect( $c->uri_for('') ); | |
| 391 | } | |
| 392 | else { | |
| 393 | $c->response->redirect( $c->uri_for( '', $id ) ); | |
| 389 | unless ( defined $c->res->location and length $c->res->location ) { | |
| 390 | ||
| 391 | if ( $c->action->name eq 'rm' ) { | |
| 392 | $c->response->redirect( $c->uri_for('') ); | |
| 393 | } | |
| 394 | else { | |
| 395 | $c->response->redirect( $c->uri_for( '', $id ) ); | |
| 396 | } | |
| 397 | ||
| 394 | 398 | } |
| 395 | 399 | |
| 396 | 1; | |
| 400 | $self->next::method( $c, $o ); | |
| 397 | 401 | } |
| 398 | 402 | |
| 399 | 403 | =head2 new |
| ... | ...@@ -153,5 +153,6 @@ | |
| 153 | 153 | * change behaviour of get_primary_key() in base Controller to not look in req->params for pk values. |
| 154 | 154 | This allows for changing the PK as part of an update. |
| 155 | 155 | * add new() in REST to call next::method. Works around (some) multiple inheritance issues. |
| 156 | * check for $c->res->location before redirecting in postcommit() | |
| 156 | 157 | |
| 157 | 158 |
| ... | ...@@ -798,13 +798,15 @@ | |
| 798 | 798 | sub postcommit { |
| 799 | 799 | my ( $self, $c, $o ) = @_; |
| 800 | 800 | |
| 801 | my $id = $self->make_primary_key_string($o); | |
| 801 | unless ( defined $c->res->location and length $c->res->location ) { | |
| 802 | my $id = $self->make_primary_key_string($o); | |
| 802 | 803 | |
| 803 | if ( $c->action->name eq 'rm' ) { | |
| 804 | $c->response->redirect( $c->uri_for('') ); | |
| 805 | } | |
| 806 | else { | |
| 807 | $c->response->redirect( $c->uri_for( '', $id, 'view' ) ); | |
| 804 | if ( $c->action->name eq 'rm' ) { | |
| 805 | $c->response->redirect( $c->uri_for('') ); | |
| 806 | } | |
| 807 | else { | |
| 808 | $c->response->redirect( $c->uri_for( '', $id, 'view' ) ); | |
| 809 | } | |
| 808 | 810 | } |
| 809 | 811 | |
| 810 | 812 | 1; |