Patch[1] for http_response.py for quixote-2.1

Hamish Lawson <[email protected]>
Newsgroups gmane.comp.web.quixote.user
Message-ID <[email protected]>
Neil Schemenauer wrote:

> Changing DEFAULT_CHARSET has no effect on what is the default for
> the HTTP protocol.

That doesn't appear to be quite what http_response.py says. If a
'charset' parameter isn't provided to HTTPResponse's __init__ then
Quixote will use DEFAULT_CHARSET for the response, unless this is
overridden by a subsequent call to set_content_type.

> If you don't provide a second argument to set_content_type
> then it's as if you did not provide the 'charset' parameter 
> on the Content-Type header.

When 'charset' parameter isn't supplied I think a Quixote user might
have expected the existing value of self.charset to be left unchanged
rather than be reset behind the scenes:

    def set_content_type(self, content_type, charset=None):
        """(content_type : string, charset : string = None)

        Set the content type of the response to the MIME type specified by
        'content_type'.  Also sets the charset if specified.
        """
        self.content_type = content_type
        if charset is not None:
            self.charset = charset


Hamish Lawson
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.