In https://bugs.python.org/issue36460 (which should be probably be disregarded until AMP is in RFC) I discovered that the types_map dictionary within the mimetypes module is a key: str to key: str (1:1) relationship. The reality is that many filename extensions commonly support multiple content-types and even sub types. A more useful structure might look like:
(fne is "file name extension" aka foo)
{
'.fne': ['type1/subtype', 'type2/subtype'],
'.htm': ['text/html', 'text/css', 'text/javascript'],
'.html': ['text/html', 'text/css', 'text/javascript']
}
However this seems to compete with the functionality of the types map so another consideration is content-types_map where the content-type is the key and the pair values are lists of valid filename extensions:
{
'audio/x-aiff': ['.aifc', '.aiff', '.au'],
'text/html': ['.html', '.htm']
} |