aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Message.py
diff options
context:
space:
mode:
authortkikuchi <>2005-04-22 00:34:11 +0000
committertkikuchi <>2005-04-22 00:34:11 +0000
commit35bc3d31ab423d6a3c8982c2499f57578872c0be (patch)
tree45f717a583b4bbf307e2e7e0c68b8e2c2adb476c /Mailman/Message.py
parent6b59d4fe0c849eebeeb938299b5ba3736dfc7941 (diff)
downloadmailman2-35bc3d31ab423d6a3c8982c2499f57578872c0be.tar.gz
mailman2-35bc3d31ab423d6a3c8982c2499f57578872c0be.tar.xz
mailman2-35bc3d31ab423d6a3c8982c2499f57578872c0be.zip
Brushing up the override function.
Diffstat (limited to '')
-rw-r--r--Mailman/Message.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/Mailman/Message.py b/Mailman/Message.py
index a5406778..4589b75a 100644
--- a/Mailman/Message.py
+++ b/Mailman/Message.py
@@ -190,12 +190,21 @@ class Message(email.Message.Message):
def get_content_charset(self, failobj=None):
"""email.Message.Message.get_content_charset() should return failobj
- on error.
+ on error. Also, check if the returned charset is supported by the
+ current running mailman instance.
"""
+ # First, trap known error in super class get_content_charset().
+ # This check will not needed if email package is updated.
try:
- return email.Message.Message.get_content_charset(self, failobj)
- except:
- return failobj
+ charset = email.Message.Message.get_content_charset(self, failobj)
+ except (LookupError, UnicodeError, ValueError):
+ return failobj
+ # Check if charset is supported.
+ try:
+ unicode('x', charset)
+ except (LookupError, ValueError):
+ return failobj
+ return charset