X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole.pm;h=7b17858b849ffdd4fa9c63374e09ee215db0df07;hb=43c32b954aa111a98b2d886f0f9c4cf18fe8dd3c;hp=858c1eb608aa1dfa264b5e1206dedbad78399e9a;hpb=3ed98309a0852fc198f9e4d0e6f70c5510c8282f;p=maypole.git diff --git a/lib/Maypole.pm b/lib/Maypole.pm index 858c1eb..7b17858 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -562,18 +562,13 @@ sub handler_guts my $applicable = $self->is_model_applicable == OK; - warn "applicable : $applicable"; - - $self->__setup_plain_template unless $applicable; - my $status; + # handle authentication eval { $status = $self->call_authenticate }; - if ( my $error = $@ ) { $status = $self->call_exception($error, "authentication"); - if ( $status != OK ) { warn "caught authenticate error: $error"; @@ -581,7 +576,6 @@ sub handler_guts $self->view_object->error($self, $error) : ERROR; } } - if ( $self->debug and $status != OK and $status != DECLINED ) { $self->view_object->error( $self, @@ -592,40 +586,32 @@ sub handler_guts # We run additional_data for every request $self->additional_data; - - if ($applicable) - { - eval { $self->model_class->process($self) }; - - if ( my $error = $@ ) + + if ($applicable) { + eval { $self->model_class->process($self) }; + if ( my $error = $@ ) { - $status = $self->call_exception($error, "model"); - - if ( $status != OK ) + $status = $self->call_exception($error, "model"); + if ( $status != OK ) { - warn "caught model error: $error"; - return $self->debug ? - $self->view_object->error($self, $error) : ERROR; + warn "caught model error: $error"; + return $self->debug ? + $self->view_object->error($self, $error) : ERROR; } } + } else { + $self->__setup_plain_template; } - + # less frequent path - perhaps output has been set to an error message return OK if $self->output; - -# warn "output before processing view : ", $self->output; # normal path - no output has been generated yet my $processed_view_ok = $self->__call_process_view; - warn "output after processing view : ", $self->output; - - warn "error after processing view : ", $self->{error}; - $self->{content_type} ||= $self->__get_mime_type(); $self->{document_encoding} ||= "utf-8"; - warn "made it to end, processed_view_ok : $processed_view_ok"; return $processed_view_ok; } @@ -663,7 +649,7 @@ sub __load_request_model sub __setup_plain_template { my ($self) = @_; - + # It's just a plain template $self->model_class(undef);