[ mailman-Patches-1189243 ] Unhandle exception in Message.get_content_charset()
Patches item #1189243, was opened at 2005-04-25 04:16 Message generated for change (Comment added) made by tkikuchi You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=300103&aid=1189243&group_id=103 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: Tokio Kikuchi (tkikuchi) Date: 2005-04-29 00: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 17: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 15: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 14: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 04: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&group_id=103
participants (1)
-
SourceForge.net