parameters: (caps, MIMEtype, key='view', filename="/dev/null", plist=[])
return_statement: return None, None
docstring: 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.
docstring_summary: Find a match for a mailcap entry.
docstring_tokens: Find a match for a mailcap entry .
function: 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
function_tokens: 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