On Mon, Aug 29, 2005 at 07:50:51PM +0100, Hamish Lawson wrote:
> And with regard to your particular example, the extract from the
> HTTP standard that I quoted above suggests that the charset
> parameter has no relevance for a binary type like image/png
> anyway.
Perhaps this will make everyone happy:
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'. If 'charset' is not provided and the content_type is
text/* then the charset attribute remains unchanged, otherwise the
charset attribute is set to None and the charset parameter will not
be included as part of the Content-Type header.
"""
content_type = content_type.lower()
if charset is not None or not content_type.startswith('text/'):
self.charset = charset
self.content_type = content_type
What do you think?
Neil