[ python-Feature Requests-1043134 ] mimetypes.guess_extension('text/plain') == '.ksh' ???

SourceForge.net noreply at sourceforge.net
Sun Dec 19 01:44:46 CET 2004


Feature Requests item #1043134, was opened at 2004-10-08 08:44
Message generated for change (Comment added) made by josiahcarlson
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1043134&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Robert Kiendl (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: mimetypes.guess_extension('text/plain') == '.ksh' ???

Initial Comment:
Instead of returning the first in the list of
extensions it should return the most reasonable . here:
to have a *.txt on disk after saveing?



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

Comment By: Josiah Carlson (josiahcarlson)
Date: 2004-12-18 16:44

Message:
Logged In: YES 
user_id=341410

While I agree with the original poster that returning '.txt'
is preferable to the others in the list returned by
mimetypes.guess_all_extensions() at least 9 times out of 10,
being able to prioritize all of the types is not necessarily
the easiest thing to do for all of the possible returned lists.

Is using a custom comparison function along with the list
returned by guess_all_extensions() sufficient?

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

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-10-11 13:15

Message:
Logged In: YES 
user_id=469548

common_types is for adding some non-standard types, not for
determining which extension is most reasonable. I'll be
happy to look at a decent patch, but I'm moving this to
feature request until then.

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

Comment By: Robert Kiendl (kxroberto)
Date: 2004-10-10 01:44

Message:
Logged In: YES 
user_id=972995

in mimetypes.py there is already a

common_types = {
    '.jpg' : 'image/jpg',
...

.txt could be added,
mayby guess_extension should first reverse-take it out of
there, not random ...?

background: my intent was to save MIME attachment as
(startable) temporary file. yet got wonderful .ksh's for
textfiles, and had to fumble ...

 


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

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-10-09 08:26

Message:
Logged In: YES 
user_id=469548

How would you suggest finding out what the most reasonable
extension for a mime type is?

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1043134&group_id=5470


More information about the Python-bugs-list mailing list