Add a content type for the part with *partname* and *content_type*,
        using a default or override as appropriate.
518009
def _add_content_type(self, partname, content_type):
        
        ext = partname.ext
        if (ext.lower(), content_type) in default_content_types:
            self._defaults[ext] = content_type
        else:
            self._overrides[partname] = content_type
1179466
def set_content_type (self):
        """"""
        if self.url:
            self.content_type = mimeutil.guess_mimetype(self.url, read=self.get_content)
        else:
            self.content_type = u""
1321823
def content_type(self, lst):
        
        value = []
        if isinstance(lst, str):
            ct = defines.Content_types[lst]
            self.add_content_type(ct)
        elif isinstance(lst, list):
            for ct in lst:
                self.add_content_type(ct)
588610
public Part createPart(String partLabel) {
	  Part part;
	  if ((part = getPart(partLabel)) != null)
		  return part;
	  // check should be requiered to see if the label is not 
	  // empty or blank character because the blank character is
	  // used as flag for the default part.
	  part = new Part(this, partLabel);
	  if (m_parts==null) m_parts = new ArrayList();
	  m_parts.add(part);
	  return part;
  }
1227832
def _set_content_type(self, system):
        
        request = system.get('request')
        if request:
            response = request.response
            ct = response.content_type
            if ct == response.default_content_type:
                response.content_type = 'application/json'
1147100
public function addPart(PartInterface $part, $name = null)
    {
        if ($name == null) {
            $name = $part->getName();
        }
        $this->parts[$name] = $part;
    }
1333217
def content_type(self, content_type):
        
        option = Option()
        option.number = defines.OptionRegistry.CONTENT_TYPE.number
        option.value = int(content_type)
        self.add_option(option)
751163
def add_default(self, ext, content_type):
        
        return self._add_default(extension=ext, contentType=content_type)
1198523
protected A contentType(String contentType) {
        this.headers.add(Pair.of("Content-Type", contentType));
        return (A)this;
    }
1066472
public MessageProtocol withContentType(String contentType) {
        return new MessageProtocol(Optional.ofNullable(contentType), charset, version);
    }
770493
protected final void addContentPart(List<ContentPart<?>> contentList,String key,String value)
    {
        if((key!=null)&&(value!=null)&&(value.length()>0))
        {
            if(this.shouldAddContentPart(key))
            {
                contentList.add(new ContentPart<String>(key,value,ContentPartType.STRING));
            }
        }
    }
695565
public void addPart(AttachmentPart part) {
        if (attachments == null) {
            attachments = new BodyPart.Attachments();
        }

        this.attachments.add(part);
    }
102142
public Response andContentType(String contentType) {
        Objects.requireNonNull(contentType, Required.CONTENT_TYPE.toString());
        this.contentType = contentType;
        this.headers.put(Header.CONTENT_TYPE.toHttpString(), contentType);

        return this;
    }
389512
private void setContentType(String contentType) {
        // The content type may contain the charset, parse it and set it.
        if (contentType != null && contentType.contains("charset=")) {
            charset = Charset.forName(contentType.substring(contentType.indexOf("charset=") + 8).trim());
        }
        headers.put(HeaderNames.CONTENT_TYPE, contentType);
    }
971908
def from_parts(cls, parts):
        
        cti = cls()
        cti._defaults['rels'] = CT.OPC_RELATIONSHIPS
        cti._defaults['xml'] = CT.XML
        for part in parts:
            cti._add_content_type(part.partname, part.content_type)
        return cti
997123
def new(ext, content_type):
        
        xml = '<Default xmlns="%s"/>' % nsmap['ct']
        default = parse_xml(xml)
        default.set('Extension', ext)
        default.set('ContentType', content_type)
        return default
799636
def add_content(self, content, mime_type=None):
        
        if isinstance(content, str):
            content = Content(mime_type, content)
        # Content of mime type text/plain must always come first
        if content.mime_type == "text/plain":
            self._contents = self._ensure_insert(content, self._contents)
        else:
            if self._contents:
                index = len(self._contents)
            else:
                index = 0
            self._contents = self._ensure_append(
                content, self._contents, index=index)