closes #3302, Render is to meant to output and allow the program to continue executing. Redirect generally serves to stop the program and start fresh with something new. This changeset makes exit the default behavior on redirect.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6208 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2007-12-23 01:17:48 +00:00
parent a2624df5f2
commit 17610a5287
2 changed files with 7 additions and 7 deletions

View file

@ -260,7 +260,7 @@ class ControllerTask extends Shell {
$actions .= "\t\tif (!\$id) {\n"; $actions .= "\t\tif (!\$id) {\n";
if ($wannaUseSession) { if ($wannaUseSession) {
$actions .= "\t\t\t\$this->Session->setFlash('Invalid {$singularHumanName}.');\n"; $actions .= "\t\t\t\$this->Session->setFlash('Invalid {$singularHumanName}.');\n";
$actions .= "\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n"; $actions .= "\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else { } else {
$actions .= "\t\t\t\$this->flash('Invalid {$singularHumanName}', array('action'=>'index'));\n"; $actions .= "\t\t\t\$this->flash('Invalid {$singularHumanName}', array('action'=>'index'));\n";
} }
@ -277,7 +277,7 @@ class ControllerTask extends Shell {
$actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n"; $actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n";
if ($wannaUseSession) { if ($wannaUseSession) {
$actions .= "\t\t\t\t\$this->Session->setFlash('The ".$singularHumanName." has been saved');\n"; $actions .= "\t\t\t\t\$this->Session->setFlash('The ".$singularHumanName." has been saved');\n";
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n"; $actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else { } else {
$actions .= "\t\t\t\t\$this->flash('{$currentModelName} saved.', array('action'=>'index'));\n"; $actions .= "\t\t\t\t\$this->flash('{$currentModelName} saved.', array('action'=>'index'));\n";
$actions .= "\t\t\t\texit();\n"; $actions .= "\t\t\t\texit();\n";
@ -317,7 +317,7 @@ class ControllerTask extends Shell {
$actions .= "\t\tif (!\$id && empty(\$this->data)) {\n"; $actions .= "\t\tif (!\$id && empty(\$this->data)) {\n";
if ($wannaUseSession) { if ($wannaUseSession) {
$actions .= "\t\t\t\$this->Session->setFlash('Invalid {$singularHumanName}');\n"; $actions .= "\t\t\t\$this->Session->setFlash('Invalid {$singularHumanName}');\n";
$actions .= "\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n"; $actions .= "\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else { } else {
$actions .= "\t\t\t\$this->flash('Invalid {$singularHumanName}', array('action'=>'index'));\n"; $actions .= "\t\t\t\$this->flash('Invalid {$singularHumanName}', array('action'=>'index'));\n";
$actions .= "\t\t\texit();\n"; $actions .= "\t\t\texit();\n";
@ -327,7 +327,7 @@ class ControllerTask extends Shell {
$actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n"; $actions .= "\t\t\tif (\$this->{$currentModelName}->save(\$this->data)) {\n";
if ($wannaUseSession) { if ($wannaUseSession) {
$actions .= "\t\t\t\t\$this->Session->setFlash('The ".$singularHumanName." has been saved');\n"; $actions .= "\t\t\t\t\$this->Session->setFlash('The ".$singularHumanName." has been saved');\n";
$actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n"; $actions .= "\t\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else { } else {
$actions .= "\t\t\t\t\$this->flash('The ".$singularHumanName." has been saved.', array('action'=>'index'));\n"; $actions .= "\t\t\t\t\$this->flash('The ".$singularHumanName." has been saved.', array('action'=>'index'));\n";
$actions .= "\t\t\t\texit();\n"; $actions .= "\t\t\t\texit();\n";
@ -368,7 +368,7 @@ class ControllerTask extends Shell {
$actions .= "\t\tif (!\$id) {\n"; $actions .= "\t\tif (!\$id) {\n";
if ($wannaUseSession) { if ($wannaUseSession) {
$actions .= "\t\t\t\$this->Session->setFlash('Invalid id for {$singularHumanName}');\n"; $actions .= "\t\t\t\$this->Session->setFlash('Invalid id for {$singularHumanName}');\n";
$actions .= "\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n"; $actions .= "\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else { } else {
$actions .= "\t\t\t\$this->flash('Invalid {$singularHumanName}', array('action'=>'index'));\n"; $actions .= "\t\t\t\$this->flash('Invalid {$singularHumanName}', array('action'=>'index'));\n";
} }
@ -376,7 +376,7 @@ class ControllerTask extends Shell {
$actions .= "\t\tif (\$this->{$currentModelName}->del(\$id)) {\n"; $actions .= "\t\tif (\$this->{$currentModelName}->del(\$id)) {\n";
if ($wannaUseSession) { if ($wannaUseSession) {
$actions .= "\t\t\t\$this->Session->setFlash('".$singularHumanName." #'.\$id.' deleted');\n"; $actions .= "\t\t\t\$this->Session->setFlash('".$singularHumanName." #'.\$id.' deleted');\n";
$actions .= "\t\t\t\$this->redirect(array('action'=>'index'), null, true);\n"; $actions .= "\t\t\t\$this->redirect(array('action'=>'index'));\n";
} else { } else {
$actions .= "\t\t\t\$this->flash('".$singularHumanName." #'.\$id.' deleted', array('action'=>'index'));\n"; $actions .= "\t\t\t\$this->flash('".$singularHumanName." #'.\$id.' deleted', array('action'=>'index'));\n";
} }

View file

@ -439,7 +439,7 @@ class Controller extends Object {
* @param boolean $exit If true, exit() will be called after the redirect * @param boolean $exit If true, exit() will be called after the redirect
* @access public * @access public
*/ */
function redirect($url, $status = null, $exit = false) { function redirect($url, $status = null, $exit = true) {
$this->autoRender = false; $this->autoRender = false;
if (is_array($status)) { if (is_array($status)) {