[Python-checkins] python/dist/src/Doc/lib libmimetypes.tex,1.10,1.11

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Fri, 06 Sep 2002 09:16:00 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv16079/Doc/lib

Modified Files:
	libmimetypes.tex 
Log Message:
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.


Index: libmimetypes.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmimetypes.tex,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** libmimetypes.tex	25 Oct 2001 21:49:18 -0000	1.10
--- libmimetypes.tex	6 Sep 2002 16:15:57 -0000	1.11
***************
*** 48,51 ****
--- 48,65 ----
  \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
***************
*** 81,84 ****
--- 95,109 ----
  \code{'\var{type}/\var{subtype}'}.  If the file \var{filename} does
  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}