redirect()
redirect(location, permanent=False)
The redirect() method of the PSPInstance object will send either a 302 Found, the default, or a 301 Moved Permanently HTTP status code to the client. Both tell the client to use the given URL to locate the resource.
The redirect() header must be the first thing sent to the browser, otherwise the redirection will not happen.
<% # Do not send anything before the redirect # A single space before the <% delimiter above # will break the redirect psp.redirect('new_page.psp') %>
The above script will make the server send this message to the client:
HTTP/1.1 302 Found Date: Sun, 05 Nov 2006 12:36:25 GMT Server: Apache/2.2.2 (Fedora) Location: new_page.psp Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8
If the permanent parameter is set to True the server response will be:
HTTP/1.1 301 Moved Permanently Date: Sun, 05 Nov 2006 12:38:40 GMT Server: Apache/2.2.2 (Fedora) Location: new_page.psp Transfer-Encoding: chunked Content-Type: text/html; charset=UTF-8
