Kaydet (Commit) f9433fec authored tarafından Antoine Pitrou's avatar Antoine Pitrou

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.
........
üst 621522b9
...@@ -164,7 +164,7 @@ def lookup(caps, MIMEtype, key=None): ...@@ -164,7 +164,7 @@ def lookup(caps, MIMEtype, key=None):
if MIMEtype in caps: if MIMEtype in caps:
entries = entries + caps[MIMEtype] entries = entries + caps[MIMEtype]
if key is not None: 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 return entries
def subst(field, MIMEtype, filename, plist=[]): def subst(field, MIMEtype, filename, plist=[]):
...@@ -239,14 +239,12 @@ def show(caps): ...@@ -239,14 +239,12 @@ def show(caps):
if not caps: caps = getcaps() if not caps: caps = getcaps()
print("Mailcap entries:") print("Mailcap entries:")
print() print()
ckeys = caps.keys() ckeys = sorted(caps)
ckeys.sort()
for type in ckeys: for type in ckeys:
print(type) print(type)
entries = caps[type] entries = caps[type]
for e in entries: for e in entries:
keys = e.keys() keys = sorted(e)
keys.sort()
for k in keys: for k in keys:
print(" %-15s" % k, e[k]) print(" %-15s" % k, e[k])
print() print()
......
...@@ -33,6 +33,9 @@ Core and Builtins ...@@ -33,6 +33,9 @@ Core and Builtins
Library Library
------- -------
- Issue #8496: make mailcap.lookup() always return a list, rather than an
iterator. Patch by Gregory Nofi.
- Issue #8195: Fix a crash in sqlite Connection.create_collation() if the - Issue #8195: Fix a crash in sqlite Connection.create_collation() if the
collation name contains a surrogate character. collation name contains a surrogate character.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment