--- On Sun, 12/21/08, Dr. Jennifer Nussbaum <[email protected]> wrote:
> From: Dr. Jennifer Nussbaum <[email protected]> > Subject: $res->body question (was Re: [Catalyst] Extra characters inserted > into PDF output > To: "The elegant MVC web framework" <[email protected]>, "Tomas > Doran" <[email protected]> > 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 > <[email protected]> wrote: > > > From: Tomas Doran <[email protected]> > > Subject: Re: [Catalyst] Extra characters inserted into > PDF output > > To: [email protected], "The elegant MVC web > framework" <[email protected]> > > 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 _______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
