[ mailman-Patches-1189243 ] Unhandle exception in Message.get_content_charset()

Patches item #1189243, was opened at 2005-04-25 00:16 Message generated for change (Comment added) made by bwarsaw You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300103&aid=1189243...
Category: None Group: Mailman 2.1 Status: Closed Resolution: Accepted Priority: 5 Submitted By: Jon Parise (jparise) Assigned to: Nobody/Anonymous (nobody) Summary: Unhandle exception in Message.get_content_charset()
Initial Comment: Message.get_content_charset() can encounter an unhandled exception "(TypeError: unicode() argument 2 must be string, not None") when charset is None. This can can only occur when the call to email.Message.Message.get_content_charset(self, failobj) itself returns None, but, not being acquainted with the email package, I don't understand the circumstances which can cause this situation.
Regardless, when charset is None, the call to unicode() will throw the TypeError exception. The attached patch recognizes this as a valid failure case such that failobj will be returned.
----------------------------------------------------------------------
Comment By: Barry A. Warsaw (bwarsaw)
Date: 2005-04-29 09:30
Message: Logged In: YES user_id=12800
Tokio, I don't like having duplicate code, so I think it's best to fix the problem in one place and not keep the workaround in Mailman's copy. I've installed email 2.5.6 now and will release Mailman 2.1.6rc3 in a little while. At my own site, all the shunted messages that were broken because of this problem have now been fixed and properly unshunted. I will be updating python.org hopefully this weekend.
Let's give rc3 a couple of weeks to shake out.
----------------------------------------------------------------------
Comment By: Tokio Kikuchi (tkikuchi) Date: 2005-04-28 20:02
Message: Logged In: YES user_id=67709
Barry, TypeError is already avoided in email package by this statement: pcharset = charset[0] or 'us-ascii'
I want to keep the latter try/except in Mailman/Message.py to assure the charset is known to mailman so that it can serve as security precaution to future mailman code changes, even after the email package is updated to 2.5.6.
----------------------------------------------------------------------
Comment By: Barry A. Warsaw (bwarsaw) Date: 2005-04-25 13:02
Message: Logged In: YES user_id=12800
If it's not too much trouble. I'd love to have a test case in the email package for the TypeError exception. If you can't, no worries.
----------------------------------------------------------------------
Comment By: Jon Parise (jparise) Date: 2005-04-25 11:46
Message: Logged In: YES user_id=485579
Sorry, I don't. Those messages were unshunted as a result of my fix. I could try to instrument a collection mechanism by trapping that exception and storing a copy of the offensive message, however. Would that still be useful?
----------------------------------------------------------------------
Comment By: Barry A. Warsaw (bwarsaw) Date: 2005-04-25 10:32
Message: Logged In: YES user_id=12800
Is there any possibility that you have a sample message that exhibits this problem? I would /really/ like to add a test case for this to the email package, which is where the patch really belongs.
----------------------------------------------------------------------
Comment By: Tokio Kikuchi (tkikuchi) Date: 2005-04-25 00:50
Message: Logged In: YES user_id=67709
Thank you! I just fixed in CVS. (I'd rather make it bare except ...)
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300103&aid=1189243...
participants (1)
-
SourceForge.net