Skip to content

Commit d4ca183

Browse files
miss-islingtonnegativenageshAA-Turner
authored
[3.12] Document mimetypes.MimeTypes.add_type() (GH-122301) (#122329)
Document ``mimetypes.MimeTypes.add_type()`` (GH-122301) (cherry picked from commit d52726c) Co-authored-by: Subrahmanya Gaonkar <[email protected]> Co-authored-by: Adam Turner <[email protected]>
1 parent 7353106 commit d4ca183

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Doc/library/mimetypes.rst

+10
Original file line numberDiff line numberDiff line change
@@ -272,3 +272,13 @@ than one MIME-type database; it provides an interface similar to the one of the
272272
types, else to the list of non-standard types.
273273

274274
.. versionadded:: 3.2
275+
276+
277+
.. method:: MimeTypes.add_type(type, ext, strict=True)
278+
279+
Add a mapping from the MIME type *type* to the extension *ext*. When the
280+
extension is already known, the new type will replace the old one. When the type
281+
is already known the extension will be added to the list of known extensions.
282+
283+
When *strict* is ``True`` (the default), the mapping will be added to the
284+
official MIME types, otherwise to the non-standard ones.

0 commit comments

Comments
 (0)