diff options
author | tkikuchi <> | 2005-04-22 00:34:11 +0000 |
---|---|---|
committer | tkikuchi <> | 2005-04-22 00:34:11 +0000 |
commit | 35bc3d31ab423d6a3c8982c2499f57578872c0be (patch) | |
tree | 45f717a583b4bbf307e2e7e0c68b8e2c2adb476c /Mailman | |
parent | 6b59d4fe0c849eebeeb938299b5ba3736dfc7941 (diff) | |
download | mailman2-35bc3d31ab423d6a3c8982c2499f57578872c0be.tar.gz mailman2-35bc3d31ab423d6a3c8982c2499f57578872c0be.tar.xz mailman2-35bc3d31ab423d6a3c8982c2499f57578872c0be.zip |
Brushing up the override function.
Diffstat (limited to 'Mailman')
-rw-r--r-- | Mailman/Message.py | 17 |
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 |