[Python-Dev] mimetypes patch #554192

Martin v. Loewis martin@v.loewis.de
16 Aug 2002 20:58:03 +0200

Walter D=F6rwald <walter@livinglogic.de> writes:

> OK, so we probably need a reverse mapping for common_types too, but
> shouldn't we consider common_types to be fixed?

If anything, types_map should be fixed: Those are the official
IANA-supported types (including the official x- extension mechanism).

The common types are those that violate IANA specs, yet found in real

If you wanted to support strictness in add_type, then you would
require that the type starts with x-; since mimetypes.py should have
all registered types incorporated (if it misses some, that's a bug).

> 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
> mimetype/extension.

Do you have a specific application for that in mind? It sounds like