The response module is accessible via the paste module.
Returns a standard HTML response page for an HTTP error. Note: Deprecated
Returns the status, headers, and body of an error response.
Use like:
1 2 3 4 5 | status, headers, body = wsgilib.error_response( '301 Moved Permanently', 'Moved to <a href="%s">%s</a>' % (url, url)) start_response(status, headers) return [body] |
Note: Deprecated
An application that emits the given error response.
Note: Deprecated
Returns the header's value, or None if no such header. If a header appears more than once, all the values of the headers are joined with ','. Note that this is consistent /w RFC 2616 section 4.2 which states:
However, note that the original netscape usage of 'Set-Cookie', especially in MSIE which contains an 'expires' date will is not compatible with this particular concatination method.
Removes the named header from the list of headers. Returns the value of that header, or None if no header found. If multiple headers are found, only the last one is returned.
Updates the headers replacing the first occurance of the given name with the value provided; asserting that no further occurances happen. Note that this is _not_ the same as remove_header and then append, as two distinct operations (del followed by an append) are not atomic in a threaded environment. Returns the previous header value for the provided name, if any. Clearly one should not use this function with set-cookie or other names that may have more than one occurance in the headers.
This represents response headers. It handles the headers as a dictionary, with case-insensitive keys.
Also there is an .add(key, value) method, which sets the key, or adds the value to the current value (turning it into a list if necessary).
For passing to WSGI there is a .headeritems() method which is like .items() but unpacks value that are lists. It also handles encoding -- all headers are encoded in ASCII (if they are unicode).
@@: Should that encoding be ISO-8859-1 or UTF-8? I'm not sure what the spec says.
This class contains 23 members.
See the source for more information.