durusmail: quixote-users: Patch[1] for http_response.py for quixote-2.1
Patch[1] for http_response.py for quixote-2.1
2005-08-21
2005-08-21
2005-08-29
2005-08-29
Re: Patch[1] for http_response.py for quixote-2.1
2005-08-29
2005-08-29
2005-09-01
behavior of set_content_type()
Re: behavior of set_content_type()
2005-08-30
2005-08-30
2005-08-30
Patch[1] for http_response.py for quixote-2.1
Hamish Lawson
2005-08-29
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
reply