$res->body question (was Re: [Catalyst] Extra characters inserted
into PDF output
Dr. Jennifer Nussbaum
bg271828 at yahoo.com
Sun Dec 21 16:12:29 GMT 2008
--- On Sun, 12/21/08, Dr. Jennifer Nussbaum <bg271828 at yahoo.com> wrote:
> From: Dr. Jennifer Nussbaum <bg271828 at yahoo.com>
> Subject: $res->body question (was Re: [Catalyst] Extra characters inserted into PDF output
> To: "The elegant MVC web framework" <catalyst at lists.scsys.co.uk>, "Tomas Doran" <bobtfish at bobtfish.net>
> Date: Sunday, December 21, 2008, 6:20 AM
> Sorry to return to this after such a long time, but i dont
> really know how to write tests for my apps, so i didnt
> realize there was a problem until just now.
>
> --- On Wed, 12/3/08, Tomas Doran
> <bobtfish at bobtfish.net> wrote:
>
> > From: Tomas Doran <bobtfish at bobtfish.net>
> > Subject: Re: [Catalyst] Extra characters inserted into
> PDF output
> > To: bg271828 at yahoo.com, "The elegant MVC web
> framework" <catalyst at lists.scsys.co.uk>
> > Date: Wednesday, December 3, 2008, 4:25 AM
> > On 3 Dec 2008, at 11:59, Dr. Jennifer Nussbaum wrote:
> > >
> > > This looks like it's going to call fillform()
> even
> > if theres a response set... <Jen codes>
> > >
> > > THATS IT!
> > >
> > > I just added "return if
> > $c->response->body;" after the forward and
> it
> > works! Nothing inserted! The problem was with fillform
> all
> > the time.
>
> The problem is that there *always* seems to be a body, so
> fillform doesnt work if im trying to do an edit.
> Specifically, in my Root.pm:
>
> sub render : ActionClass('RenderView') { }
>
> sub end : Private {
> my ( $self, $c ) = @_;
> $c->forward('render');
> if ($c->res->body) {
> $c->log->info("There is a body; returning");
> return; }
> if (defined $c->stash->{edit_data} ) {
> $c->fillform( $c->stash->{edit_data} );
> } else {
> $c->fillform;
> }
> }
>
> When i try to edit a page, which just goes through the
> usual Catalyst stuff, i find thta i still get a "There
> is a body; returning" message in my debug log. That is
> i get a body no matter what (here i am not generating a PDF
> page, just a regular page through TT), and fillform never
> runs. So i cant edit anything, it doesnt fill the form back
> in from my database.
>
> Is something in the wrong place? Why do i have a body here?
Never mind, i see that i just have to move the "return if $c->res->body"
call to _before_ the render call. No need to ship to the view if theres already a body, so....
Sorry i should have tried this first.
Jen
More information about the Catalyst
mailing list