Back to module index
Go to module by name
mailcap
Mailcap file handling. See RFC 1524.
Classes
UnsafeMailcapInput
Warning raised when refusing unsafe input
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Functions
findmatch
findmatch(caps, MIMEtype, key='view', filename='/dev/null', plist=[])
Find a match for a mailcap entry.
Return a tuple containing the command line, and the mailcap entry
used; (None, None) if no match is found. This may invoke the
'test' command of several matching entries before deciding which
entry to use.
findparam
findparam(name, plist)
getcaps
getcaps()
Return a dictionary containing the mailcap database.
The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
to a list of dictionaries corresponding to mailcap entries. The list
collects all the entries for that MIME type from all available mailcap
files. Each dictionary contains key-value pairs for that MIME type,
where the viewing command is stored with the key "view".
lineno_sort_key
lineno_sort_key(entry)
listmailcapfiles
listmailcapfiles()
Return a list of all mailcap files found on the system.
lookup
lookup(caps, MIMEtype, key=None)
parsefield
parsefield(line, i, n)
Separate one key-value pair in a mailcap entry.
parseline
parseline(line)
Parse one entry in a mailcap file and return a dictionary.
The viewing command is stored as the value with the key "view",
and the rest of the fields produce key-value pairs in the dict.
readmailcapfile
readmailcapfile(fp)
Read a mailcap file and return a dictionary keyed by MIME type.
show
show(caps)
subst
subst(field, MIMEtype, filename, plist=[])
test
test()
Modules
os
re
warnings