diff options
author | Barry Warsaw <barry@python.org> | 2006-07-21 14:51:07 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2006-07-21 14:51:07 (GMT) |
commit | b110bad2d9c1c4fcfafdc75db2213cbc0b753342 (patch) | |
tree | 8758d3c6a8dfd1cdde2c04e7304211f1e7253a83 /Misc | |
parent | d12bd012a6a4729b5a77c1019ca9da4e9d1b7e3e (diff) | |
download | cpython-b110bad2d9c1c4fcfafdc75db2213cbc0b753342.zip cpython-b110bad2d9c1c4fcfafdc75db2213cbc0b753342.tar.gz cpython-b110bad2d9c1c4fcfafdc75db2213cbc0b753342.tar.bz2 |
More RFC 2231 improvements for the email 4.0 package. As Mark Sapiro rightly
points out there are really two types of continued headers defined in this
RFC (i.e. "encoded" parameters with the form "name*0*=" and unencoded
parameters with the form "name*0="), but we were were handling them both the
same way and that isn't correct.
This patch should be much more RFC compliant in that only encoded params are
%-decoded and the charset/language information is only extract if there are
any encoded params in the segments. If there are no encoded params then the
RFC says that there will be no charset/language parts.
Note however that this will change the return value for Message.get_param() in
some cases. For example, whereas before if you had all unencoded param
continuations you would have still gotten a 3-tuple back from this method
(with charset and language == None), you will now get just a string. I don't
believe this is a backward incompatible change though because the
documentation for this method already indicates that either return value is
possible and that you must do an isinstance(val, tuple) check to discriminate
between the two. (Yeah that API kind of sucks but we can't change /that/
without breaking code.)
Test cases, some documentation updates, and a NEWS item accompany this patch.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -44,6 +44,18 @@ Library - Patch #1220874: Update the binhex module for Mach-O. +- The email package has improved RFC 2231 support, specifically for + recognizing the difference between encoded (name*0*=<blah>) and non-encoded + (name*0=<blah>) parameter continuations. This may change the types of + values returned from email.message.Message.get_param() and friends. + Specifically in some cases where non-encoded continuations were used, + get_param() used to return a 3-tuple of (None, None, string) whereas now it + will just return the string (since non-encoded continuations don't have + charset and language parts). + + Also, whereas % values were decoded in all parameter continuations, they are + now only decoded in encoded parameter parts. + Extension Modules ----------------- |