Ignore:
Timestamp:
12/02/08 12:49:15 (3 years ago)
Author:
CrawfordCurrie
Message:

Item139: removed oops redirect for error reports. Fixed status header in HTTP responses.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WorkflowPlugin/lib/TWiki/Plugins/WorkflowPlugin.pm

    r1090 r1127  
    241241    if ( !$query->param('INWORKFLOWSEQUENCE') && !$TOPIC->canEdit() ) { 
    242242        throw TWiki::OopsException( 
    243             'accessdenied', 
     243            'accessdenied', status => 403, 
    244244            def   => 'topic_access', 
    245245            web   => $_[2], 
     
    285285 
    286286        try { 
    287             $query->param('INWORKFLOWSEQUENCE' => 1); 
    288             $TOPIC->changeState($action); 
    289             if ($newForm) { 
    290  
    291                 # If there is a form with the new state, and it's not the same 
    292                 # form as previously, we need to kick into edit mode to support 
    293                 # form field changes. 
    294                 $url = TWiki::Func::getScriptUrl( 
    295                     $web, $topic, 'edit', 
    296                     INWORKFLOWSEQUENCE => time()); 
     287            try { 
     288                $query->param('INWORKFLOWSEQUENCE' => 1); 
     289                if ($newForm) { 
     290                    # If there is a form with the new state, and it's not 
     291                    # the same form as previously, we need to kick into edit 
     292                    # mode to support form field changes. 
     293                    $url = TWiki::Func::getScriptUrl( 
     294                        $web, $topic, 'edit', 
     295                        INWORKFLOWSEQUENCE => time()); 
     296                } 
     297                else { 
     298                    $url = TWiki::Func::getScriptUrl( $web, $topic, 'view' ); 
     299                } 
     300                # SMELL: don't do this until the edit is over 
     301                $TOPIC->changeState($action); 
     302                TWiki::Func::redirectCgiQuery( undef, $url ); 
     303            } catch Error::Simple with { 
     304                my $error = shift; 
     305                throw TWiki::OopsException( 
     306                    'oopssaveerr', 
     307                    web => $web, topic => $topic, 
     308                    params => [ $error || '?' ]); 
     309            }; 
     310        } catch TWiki::OopsException with { 
     311            my $e = shift; 
     312            if ($e->can('generate')) { 
     313                $e->generate( $session ); 
     314            } else { 
     315                # Deprecated, TWiki compatibility only 
     316                $e->redirect( $session ); 
    297317            } 
    298             else { 
    299                 $url = TWiki::Func::getScriptUrl( $web, $topic, 'view' ); 
    300             } 
    301         } 
    302         catch Error::Simple with { 
    303             my $error = shift; 
    304             $url = TWiki::Func::getScriptUrl( 
    305                 $web, $topic, 'oops', 
    306                 template => "oopssaveerr", 
    307                 param1   => $error 
    308             ); 
    309         } 
    310         catch TWiki::OopsException with { 
    311             shift->redirect( $session ); 
    312318 
    313319        }; 
    314320    } 
    315     TWiki::Func::redirectCgiQuery( undef, $url ); 
    316321    return undef; 
    317322} 
Note: See TracChangeset for help on using the changeset viewer.