diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-04-22 13:56:42 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-04-22 13:56:42 (GMT) |
commit | f9433fec8ba5f225cf3e423a2c0a95966e243abf (patch) | |
tree | f4f93364731f6dfa611a9b40aa959942ec9cf02c /Lib | |
parent | 621522b92c0074c222556dba32b3603bab6cab40 (diff) | |
download | cpython-f9433fec8ba5f225cf3e423a2c0a95966e243abf.zip cpython-f9433fec8ba5f225cf3e423a2c0a95966e243abf.tar.gz cpython-f9433fec8ba5f225cf3e423a2c0a95966e243abf.tar.bz2 |
Merged revisions 80368-80369 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r80368 | antoine.pitrou | 2010-04-22 15:19:31 +0200 (jeu., 22 avril 2010) | 3 lines
Fix mailcap.py built-in test.
........
r80369 | antoine.pitrou | 2010-04-22 15:30:10 +0200 (jeu., 22 avril 2010) | 5 lines
Issue #8496: make mailcap.lookup() always return a list, rather than an iterator.
Patch by Gregory Nofi.
........
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/mailcap.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Lib/mailcap.py b/Lib/mailcap.py index 086f05c..4ae13d7 100644 --- a/Lib/mailcap.py +++ b/Lib/mailcap.py @@ -164,7 +164,7 @@ def lookup(caps, MIMEtype, key=None): if MIMEtype in caps: entries = entries + caps[MIMEtype] if key is not None: - entries = filter(lambda e, key=key: key in e, entries) + entries = [e for e in entries if key in e] return entries def subst(field, MIMEtype, filename, plist=[]): @@ -239,14 +239,12 @@ def show(caps): if not caps: caps = getcaps() print("Mailcap entries:") print() - ckeys = caps.keys() - ckeys.sort() + ckeys = sorted(caps) for type in ckeys: print(type) entries = caps[type] for e in entries: - keys = e.keys() - keys.sort() + keys = sorted(e) for k in keys: print(" %-15s" % k, e[k]) print() |