Revision: 3158
          http://spambayes.svn.sourceforge.net/spambayes/?rev=3158&view=rev
Author:   montanaro
Date:     2007-08-03 15:41:12 -0700 (Fri, 03 Aug 2007)

Log Message:
-----------
it looks like email.Header.decode_header can raise ValueError

Modified Paths:
--------------
    trunk/spambayes/spambayes/UserInterface.py
    trunk/spambayes/spambayes/tokenizer.py

Modified: trunk/spambayes/spambayes/UserInterface.py
===================================================================
--- trunk/spambayes/spambayes/UserInterface.py  2007-07-27 13:34:45 UTC (rev 
3157)
+++ trunk/spambayes/spambayes/UserInterface.py  2007-08-03 22:41:12 UTC (rev 
3158)
@@ -218,7 +218,7 @@
 
         try:
             sections = email.Header.decode_header(field)
-        except (binascii.Error, email.Errors.HeaderParseError):
+        except (binascii.Error, email.Errors.HeaderParseError, ValueError):
             sections = [(field, None)]
         field = ' '.join([text for text, unused in sections])
         if len(field) > limit:

Modified: trunk/spambayes/spambayes/tokenizer.py
===================================================================
--- trunk/spambayes/spambayes/tokenizer.py      2007-07-27 13:34:45 UTC (rev 
3157)
+++ trunk/spambayes/spambayes/tokenizer.py      2007-08-03 22:41:12 UTC (rev 
3158)
@@ -1369,7 +1369,7 @@
         x = msg.get('subject', '')
         try:
             subjcharsetlist = email.Header.decode_header(x)
-        except (binascii.Error, email.Errors.HeaderParseError):
+        except (binascii.Error, email.Errors.HeaderParseError, ValueError):
             subjcharsetlist = [(x, 'invalid')]
         for x, subjcharset in subjcharsetlist:
             if subjcharset is not None:
@@ -1404,7 +1404,8 @@
                 if name:
                     try:
                         subjcharsetlist = email.Header.decode_header(name)
-                    except (binascii.Error, email.Errors.HeaderParseError):
+                    except (binascii.Error, email.Errors.HeaderParseError,
+                            ValueError):
                         subjcharsetlist = [(name, 'invalid')]
                     for name, charset in subjcharsetlist:
                         yield "%s:name:%s" % (field, name.lower())


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Spambayes-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/spambayes-checkins

Reply via email to