web/request.py
changeset 6366 1806148d6ce8
parent 6353 b622602f8e9d
child 6543 66145280a7e6
equal deleted inserted replaced
6333:e3994fcc21c3 6366:1806148d6ce8
   529 
   529 
   530     def set_content_type(self, content_type, filename=None, encoding=None):
   530     def set_content_type(self, content_type, filename=None, encoding=None):
   531         """set output content type for this request. An optional filename
   531         """set output content type for this request. An optional filename
   532         may be given
   532         may be given
   533         """
   533         """
   534         if content_type.startswith('text/'):
   534         if content_type.startswith('text/') and ';charset=' not in content_type:
   535             content_type += ';charset=' + (encoding or self.encoding)
   535             content_type += ';charset=' + (encoding or self.encoding)
   536         self.set_header('content-type', content_type)
   536         self.set_header('content-type', content_type)
   537         if filename:
   537         if filename:
   538             if isinstance(filename, unicode):
   538             if isinstance(filename, unicode):
   539                 filename = header(filename).encode()
   539                 filename = header(filename).encode()