[Python-bugs-list] [ python-Bugs-474583 ] non-standard types in mimetypes.py

noreply@sourceforge.net noreply@sourceforge.net
Wed, 24 Oct 2001 11:57:46 -0700


Bugs item #474583, was opened at 2001-10-24 11:57
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=474583&group_id=5470

Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Barry Warsaw (bwarsaw)
Assigned to: Martin v. Löwis (loewis)
Summary: non-standard types in mimetypes.py

Initial Comment:
In the spirit of "be liberal in what you accept", I
think mimetypes should have an option which searches
non-standard but common types.  E.g. I just received an
email message which had a content type of image/jpg and
I wanted to store that in a file with the proper
extension.  But mimetypes couldn't give that to me
because image/jpeg is the official type.

Attached is a patch to add an optional "strict" flag to
guess_type() and guess_extension().  strict defaults to
1 to keep the current behavior.  Set it to 0 and some
additional types are searched.  I added back the
non-standard types that Martin removed in revision 1.19
of the file.

This patch also contains a small improvement to the
command line options when this is run as a script.  I
can split the patch into two parts if necessary, but I
don't think it is.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=474583&group_id=5470