summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2002-09-06 16:15:58 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2002-09-06 16:15:58 (GMT)
commit5ccaf8f1298628bea5a4c7442413f2901914f1bc (patch)
tree218c01a700b8053931a5748029331cb756801656 /Doc
parent2c519981fb7b0992afe8168bb7781e6ed8d49531 (diff)
downloadcpython-5ccaf8f1298628bea5a4c7442413f2901914f1bc.zip
cpython-5ccaf8f1298628bea5a4c7442413f2901914f1bc.tar.gz
cpython-5ccaf8f1298628bea5a4c7442413f2901914f1bc.tar.bz2
Apply diff3.txt (plus additional documentation)
from SF patch http://www.python.org/sf/554192 This adds two new functions to mimetypes: guess_all_extensions() which returns a list of all known extensions for a mime type, and add_type() which adds one mapping between a mime type and an extension.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libmimetypes.tex25
1 files changed, 25 insertions, 0 deletions
diff --git a/Doc/lib/libmimetypes.tex b/Doc/lib/libmimetypes.tex
index 3747fe1..64296f0 100644
--- a/Doc/lib/libmimetypes.tex
+++ b/Doc/lib/libmimetypes.tex
@@ -47,6 +47,20 @@ IANA types are supported; when \var{strict} is false, some additional
non-standard but commonly used MIME types are also recognized.
\end{funcdesc}
+\begin{funcdesc}{guess_all_extensions}{type\optional{, strict}}
+Guess the extensions for a file based on its MIME type, given by
+\var{type}.
+The return value is a list of strings giving all possible filename extensions,
+including the leading dot (\character{.}). The extensions are not guaranteed
+to have been associated with any particular data stream, but would be mapped
+to the MIME type \var{type} by \function{guess_type()}. If no extension can
+be guessed for \var{type}, \code{None} is returned.
+
+Optional \var{strict} has the same meaning as with the
+\function{guess_type()} function.
+\end{funcdesc}
+
+
\begin{funcdesc}{guess_extension}{type\optional{, strict}}
Guess the extension for a file based on its MIME type, given by
\var{type}.
@@ -83,6 +97,17 @@ not exist or cannot be read, \code{None} is returned.
\end{funcdesc}
+\begin{funcdesc}{add_type}{type, ext\optional{, strict}}
+Add a mapping from the mimetype \var{type} to the extension \var{ext}.
+When the extension is already known, the new type will replace the old
+one. When the type is already known the extension will be added
+to the list of known extensions.
+
+When \var{strict} is the mapping will added to the official
+MIME types, otherwise to the non-standard ones.
+\end{funcdesc}
+
+
\begin{datadesc}{inited}
Flag indicating whether or not the global data structures have been
initialized. This is set to true by \function{init()}.