(caps, MIMEtype, key='view', filename="/dev/null", plist=[])
return None, None
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.
Find a match for a mailcap entry.
Find a match for a mailcap entry .
def 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.

    """
    entries = lookup(caps, MIMEtype, key)
    # XXX This code should somehow check for the needsterminal flag.
    for e in entries:
        if 'test' in e:
            test = subst(e['test'], filename, plist)
            if test and os.system(test) != 0:
                continue
        command = subst(e[key], MIMEtype, filename, plist)
        return command, e
    return None, None
def findmatch ( caps , MIMEtype , key = 'view' , filename = "/dev/null" , plist = [ ] ) : entries = lookup ( caps , MIMEtype , key ) # XXX This code should somehow check for the needsterminal flag. for e in entries : if 'test' in e : test = subst ( e [ 'test' ] , filename , plist ) if test and os . system ( test ) != 0 : continue command = subst ( e [ key ] , MIMEtype , filename , plist ) return command , e return None , None