Mailing List Archive

patch status_multiple_choices for Controller::REST
Hi,

Attached is a patch to add additional helper function for REST controller.
I also attached the corresponding patch for RenderView.
This also should make the cat more RFC-friendly as 3xx responses should provide
"entity" (not sure about 304 nor 305 though, feel free to keep these).

cheers
Re: patch status_multiple_choices for Controller::REST [ In reply to ]
On 24 Apr 2010, at 11:45, Fabien Wernli wrote:
> Attached is a patch to add additional helper function for REST
> controller.
> I also attached the corresponding patch for RenderView.
> This also should make the cat more RFC-friendly as 3xx responses
> should provide
> "entity" (not sure about 304 nor 305 though, feel free to keep these).

I entirely agree on this for ::REST (and I've just incorporated your
patch + some additional tests into the new version), however
for ::RenderView I think this is likely to be dangerous - as people
who are expecting to be able to set a redirect and then not render a
page will start rendering a page.

This could cause breakage if the application catches an exception
during the view (e.g. a template not being there as we previously
redirected), resulting in a 500 error going to to user, or slowdown if
rendering the page doesn't have the appropriate join conditions (and
ergo displays _a lot_ of data).

I'd be happy with a patch that made this configurable (and added
appropriate tests), if you think this is important for ::RenderView -
however I think RenderView is used in more traditional type web apps
where you don't usually want to render a page with a redirect, whereas
Action::Serialize is used (instead) in lots of REST cases where
returning an entity is appropriate.

Cheers
t0m


_______________________________________________
Catalyst-dev mailing list
Catalyst-dev@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst-dev