From 35bc3d31ab423d6a3c8982c2499f57578872c0be Mon Sep 17 00:00:00 2001 From: tkikuchi <> Date: Fri, 22 Apr 2005 00:34:11 +0000 Subject: Brushing up the override function. --- Mailman/Message.py | 17 +++++++++++++---- 1 file 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 -- cgit v1.2.3