The WSGIResponse class is accessible via the paste.wsgiwrappers module.
The class variable defaults specifies default values for content_type, charset and errors. These can be overridden for the current request via the registry.
Get/set the specified content, where content can be: a string, a list of strings, a generator function that yields strings, or an iterable object that produces strings.
Get/set the Content-Type header (or None), without the charset or any parameters.
If you include parameters (or ; at all) when setting the content_type, any existing parameters will be deleted; otherwise they will be preserved.
{'headers': {'Cache-Control': 'no-cache'}, 'errors': 'strict', 'charset': 'utf-8', 'content_type': 'text/html'}
Convenience call to return output and set status information
Conforms to the WSGI interface for calling purposes only.
Example usage:
1 2 3 4 5 | def wsgi_app(environ, start_response): response = WSGIResponse() response.write("Hello world") response.headers['Content-Type'] = 'latin1' return response(environ, start_response) |
Get/set the Content-Type header (or None), without the charset or any parameters.
If you include parameters (or ; at all) when setting the content_type, any existing parameters will be deleted; otherwise they will be preserved.
Notify the browser the specified cookie has expired and should be deleted (via the outgoing HTTP headers)
Determine the encoding as specified by the Content-Type's charset parameter, if one is set
Returns the content as an iterable of strings, encoding each element of the iterator from a Unicode object if necessary.
Define a cookie to be sent via the outgoing HTTP headers
Return this WSGIResponse as a tuple of WSGI formatted data, including: (status, headers, iterable)
See the source for more information.