12.7.1 MimeTypes Objects
MimeTypes instances provide an interface which is very like
that of the mimetypes module.
- suffix_map
-
Dictionary mapping suffixes to suffixes. This is used to allow
recognition of encoded files for which the encoding and the type are
indicated by the same extension. For example, the .tgz
extension is mapped to .tar.gz to allow the encoding and type
to be recognized separately. This is initially a copy of the global
suffix_map
defined in the module.
- encodings_map
-
Dictionary mapping filename extensions to encoding types. This is
initially a copy of the global
encodings_map
defined in the
module.
- types_map
-
Dictionary mapping filename extensions to MIME types. This is
initially a copy of the global
types_map
defined in the
module.
- common_types
-
Dictionary mapping filename extensions to non-standard, but commonly
found MIME types. This is initially a copy of the global
common_types
defined in the module.
-
Similar to the guess_extension() function, using the
tables stored as part of the object.
-
Similar to the guess_type() function, using the tables
stored as part of the object.
-
Load MIME information from a file named path. This uses
readfp() to parse the file.
-
Load MIME type information from an open file. The file must have
the format of the standard mime.types files.
Release 2.4a0, documentation updated on 23 September 2003.
See About this document... for information on suggesting changes.