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?

Martin

-- 
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book

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

Reply via email to