Castalian

The Response Object

The Response object is used to send output back to the browser.

response.write function

response.write(string,[string,string...])
Writes string into the output stream.

response.writeln function

response.writeln(string,[string,string...])
Writes string into the output stream, followed by a newline.

response.content_type function

response.content_type(mimetype)
Changes the MIME type of the page from its default of text/html. Useful for making a cas page a graphic to be called in an <img> tag, or for displaying binary documents directly out of a database.

response.addheader function

response.addheader(name,value)
Adds an additional HTTP header to the output stream. This must be called before your page displays any HTML, or it will be ignored.

response.redirect function

response.redirect(URL)
Redirects the browser to the specified URL (with a 302 status code). This must be called before your page displays any HTML, or it will be ignored.

response.end function

response.end()
Stops output, terminates processing of the page. Remember that this is a function, so you need the brackets when you call it!

response.cookies dictionary

response.cookies["cookiename"] = "cookievalue"
Sets cookies. response.cookies is a fairly standard Python dictionary. To set a cookie called "foo" to value "bar", say response.cookies["foo"] = "bar".
Advanced Cookie usage