Staging
v0.5.1
swh:1:snp:635f4099902912592851108bcac178ff574f7c5f
Revision f5853f7592fac39e7f6d0bccc0884b666b9edd99 authored by Barry Warsaw on 08 February 2006, 13:33:20 UTC, committed by Barry Warsaw on 08 February 2006, 13:33:20 UTC
(.set_payload() gives bad .get_payload() results).  Specific changes include:

Simplfy the default CODEC_MAP in Charset.py to not include the Japanese and
Korean codecs.  The names of the codecs are different depending on whether
you're using Python 2.4 and 2.5, which include the codecs by default, or
earlier Python's which provide the codecs under different names as a third
party library.  Now, we attempt to discover which (if either) is available and
populate the CODEC_MAP as appropriate.

Message.set_charset(): When the message does not already have a
Content-Transfer-Encoding header, instead of just adding the header, we also
encode the body as defined by the assigned Charset.  As before, if the
body_encoding is callable, we just call that.  If not, then we add a call to
body_encode() before setting the header.  This way, we guarantee that a
message's text payload is always encoded properly.

Remove the payload encoding code from Generator._handle_text().  With the
above patch, this would cause the body to be doubly encoded.  Doing this in
the Message class is better than only doing it in the Generator.

Added some new tests to ensure everything works correctly.  Also changed the
way the test_email_codecs.py tests get added (using the same lookup code that
the CODEC_MAP adjustments use).

This resolves both issues for email 2.5/Python 2.3.  I will patch forward to
email 3.0 for both Python 2.4 and 2.5.
1 parent 784fccf
History
Tip revision: 550e4673be538d98b6ddf5550b3922539cf5c4b2 authored by Victor Stinner on 08 December 2020, 23:32:54 UTC
bpo-32381: Add _PyRun_SimpleFileObject() (GH-23709)
Tip revision: 550e467
File Mode Size
Demo
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Python
RISCOS
Tools
.cvsignore -rw-r--r-- 109 bytes
.hgtags -rw-r--r-- 2.6 KB
LICENSE -rw-r--r-- 12.9 KB
Makefile.pre.in -rw-r--r-- 31.3 KB
README -rw-r--r-- 48.3 KB
aclocal.m4 -rw-r--r-- 2.1 KB
configure -rwxr-xr-x 590.0 KB
configure.in -rw-r--r-- 86.0 KB
install-sh -rwxr-xr-x 7.0 KB
pyconfig.h.in -rw-r--r-- 24.7 KB
setup.py -rw-r--r-- 51.2 KB

README

back to top