[Zope3-dev] No redirect!

Tres Seaver tseaver@zope.com
26 Apr 2003 12:34:18 -0400


On Sat, 2003-04-26 at 10:24, Barry Warsaw wrote:
> On Fri, 2003-04-25 at 19:51, Stephan Richter wrote:
> 
> > I totally agree with Marcus' complaint. I hate the request.response.redirect 
> > stuff as well. I wish I could say request.response.returnView(URL) that looks 
> > up the view and returns it without a redirect.
> > 
> > What do others think about that?
> > 
> +1

-1 for returning HTML directly from a non-idempotent form submission:
the URL of the submission's request won't correspond properly to the
view being presented.  Applications which follow Stephan's suggested
path end up breaking the browser's back button, as well as exposing
non-bookmarkable URLs.

RFC 2616 actually recognizes this condition by adding a new redirection
respons code, 303.  The spec also blesses the frequent-but-noncompliant
current usage of 302 response codes (for older clients which don't
understand 303):

  http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.4

Note this language in particular:

  The new URI is not a substitute reference for the originally requested
  resource.

Note as well that I am not suggesting that *all* form submissions should
redirect:  the prototypical search query, for instance, is the ideal
counterexample.

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com