web/request.py
branchstable
changeset 6353 b622602f8e9d
parent 6259 c3d98e4bee12
child 6543 66145280a7e6
equal deleted inserted replaced
6352:2259d834d757 6353:b622602f8e9d
   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()