[Python-Dev] mimetypes patch #554192

Walter Dörwald walter@livinglogic.de
Wed, 04 Sep 2002 23:21:40 +0200

Martin v. Loewis wrote:

> Walter Dörwald <walter@livinglogic.de> writes:
>>>>Even better would be, if we could assign priorities to the mappings,
>>>>so that for e.g. image/jpeg the preferred extension is .jpeg.
>>>>Then guess_type() and guess_extension() would return the preferred
>>>Do you have a specific application for that in mind? It sounds like
>>I'm using a web mirror script which uses the extensions from
>>guess_extension to save all downloaded resources, and I hate it
>>when the HTML files are named .htm and JPEG images are named .jpe.
> Then this is your preference - others might prefer jpg, just because
> their file system can deal better with that. If you can agree that
> this is your preference, you should put the preference mechanism into
> the application.

Agreed, other applications might have other priorities.

> Maybe your preference can be expressed algorithmically? It might be
> that you always want the longest known extension (it is unlikely that
> you prefer "jpeg" over "jpg" just because that contains a vowel :-).

I guess it's "longest one" or "the one most unencumbered by filesystem

OK, so lets drop the priority idea. What do we do with the patch
as it is now?

    Walter Dörwald