On 2/23/10 15:33 , Martin Aspeli wrote:
> Hi,
> A lot of the forms I write perform a redirect at the end of the action
> handler for a successfully submitted form.
> z3c.form's __call__() indiscriminately calls update() and then render().
> This means that even if something in update() (the action handler in
> this case) causes a redirect, the render() method is called, which is
> unnecessary since the browser will ignore the response body and perform
> the redirect. It also triggered a small bug in Plone (since worked
> around) whereby status messages would be output on the "hidden" page and
> go missing for the final page (status messages in Plone can be persisted
> across redirects using a cookie).
> Grok's forms do something like this:
>     def __call__(self):
>         self.update()
>         if self.request.response.getStatus() not in (301, 302):
>             return self.render()
>         return u''
> Would it be an idea for z3c.form to do the same?


I would be in favour skipping render() for any status outside of 2XX 
instead of hardcoding 301 & 302.

Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope )

Reply via email to