[Python-checkins] python/dist/src/Lib mimetypes.py,1.27,1.28

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
2003年6月09日 15:27:43 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv21947/Lib
Modified Files:
	mimetypes.py 
Log Message:
guess_all_extensions(): Return the empty list instead of None when
there are no matching types. Updated the docs and docstrings. Added
some unit tests.
Index: mimetypes.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mimetypes.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** mimetypes.py	4 Jan 2003 14:11:38 -0000	1.27
--- mimetypes.py	9 Jun 2003 22:27:40 -0000	1.28
***************
*** 149,156 ****
 Return value is a list of strings giving the possible filename
 extensions, including the leading dot ('.'). The extension is not
! guaranteed to have been associated with any particular data
! stream, but would be mapped to the MIME type `type' by
! guess_type(). If no extension can be guessed for `type', None
! is returned.
 
 Optional `strict' argument when false adds a bunch of commonly found,
--- 149,154 ----
 Return value is a list of strings giving the possible filename
 extensions, including the leading dot ('.'). The extension is not
! guaranteed to have been associated with any particular data stream,
! but would be mapped to the MIME type `type' by guess_type().
 
 Optional `strict' argument when false adds a bunch of commonly found,
***************
*** 163,168 ****
 if ext not in extensions:
 extensions.append(ext)
! if len(extensions):
! return extensions
 
 def guess_extension(self, type, strict=True):
--- 161,165 ----
 if ext not in extensions:
 extensions.append(ext)
! return extensions
 
 def guess_extension(self, type, strict=True):
***************
*** 180,186 ****
 """
 extensions = self.guess_all_extensions(type, strict)
! if extensions is not None:
! extensions = extensions[0]
! return extensions
 
 def read(self, filename, strict=True):
--- 177,183 ----
 """
 extensions = self.guess_all_extensions(type, strict)
! if not extensions:
! return None
! return extensions[0]
 
 def read(self, filename, strict=True):

AltStyle によって変換されたページ (->オリジナル) /