summaryrefslogtreecommitdiffstats
path: root/Lib/email/__init__.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-09-30 15:23:17 (GMT)
committerBarry Warsaw <barry@python.org>2002-09-30 15:23:17 (GMT)
commitd20b66537cd6ae9602feb7c6e237a60adf75739c (patch)
tree5de7a6384ca7bb4ee72af98fa8d449a4687d1b37 /Lib/email/__init__.py
parenta2a07bce895c36749fc9f96f384dcba1844ff3d4 (diff)
downloadcpython-d20b66537cd6ae9602feb7c6e237a60adf75739c.zip
cpython-d20b66537cd6ae9602feb7c6e237a60adf75739c.tar.gz
cpython-d20b66537cd6ae9602feb7c6e237a60adf75739c.tar.bz2
The ansi_x3.4_1968 encoding is an alias for ascii, but isn't known in
Python 2.1.3. However it's required by the email tests suite, so poke it into the encodings aliases if it's missing. The is apparently the approved API for doing so. Now we can remove the hexversion shortcircuits in the test suite.
Diffstat (limited to 'Lib/email/__init__.py')
-rw-r--r--Lib/email/__init__.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/email/__init__.py b/Lib/email/__init__.py
index f7759b7..fd129a3 100644
--- a/Lib/email/__init__.py
+++ b/Lib/email/__init__.py
@@ -59,3 +59,12 @@ def message_from_file(fp, _class=None, strict=False):
from email.Message import Message
_class = Message
return Parser(_class, strict=strict).parse(fp)
+
+
+
+# Patch encodings.aliases to recognize 'ansi_x3.4_1968' which isn't a standard
+# alias in Python 2.1.3, but is used by the email package test suite.
+from encodings.aliases import aliases # The aliases dictionary
+if not aliases.has_key('ansi_x3.4_1968'):
+ aliases['ansi_x3.4_1968'] = 'ascii'
+del aliases # Not needed any more