SF.net SVN: tmda: [2187] trunk/tmda/TMDA

[email protected] Thu, 26 Apr 2007 13:31:01 -0700
Newsgroups gmane.mail.spam.tmda.cvs
Message-ID <[email protected]>
Revision: 2187
          http://svn.sourceforge.net/tmda/?rev=2187&view=rev
Author:   jasonrm
Date:     2007-04-26 13:29:55 -0700 (Thu, 26 Apr 2007)

Log Message:
-----------
minor upgrade to the Python email lib. v4.0.2, same version that's in Python 
2.5.1.

Modified Paths:
--------------
    trunk/tmda/TMDA/ChangeLog
    trunk/tmda/TMDA/pythonlib/email/_parseaddr.py
    trunk/tmda/TMDA/pythonlib/email/charset.py
    trunk/tmda/TMDA/pythonlib/email/header.py
    trunk/tmda/TMDA/pythonlib/email/message.py

Modified: trunk/tmda/TMDA/ChangeLog
===================================================================
--- trunk/tmda/TMDA/ChangeLog	2007-04-16 16:43:42 UTC (rev 2186)
+++ trunk/tmda/TMDA/ChangeLog	2007-04-26 20:29:55 UTC (rev 2187)
@@ -1,3 +1,7 @@
+2007-04-26  Jason R. Mastaler  <[email protected]>
+
+	* pythonlib/email: Sync up with email 4.0.2.
+
 2007-03-01  Jason R. Mastaler  <[email protected]>
 
 	* SMTP.py (Connection.__connect): bugfix: TLS must come before

Modified: trunk/tmda/TMDA/pythonlib/email/_parseaddr.py
===================================================================
--- trunk/tmda/TMDA/pythonlib/email/_parseaddr.py	2007-04-16 16:43:42 UTC (rev 2186)
+++ trunk/tmda/TMDA/pythonlib/email/_parseaddr.py	2007-04-26 20:29:55 UTC (rev 2187)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002-2006 Python Software Foundation
+# Copyright (C) 2002-2007 Python Software Foundation
 # Contact: [email protected]
 
 """Email address parsing code.
@@ -172,6 +172,7 @@
         self.pos = 0
         self.LWS = ' \t'
         self.CR = '\r\n'
+        self.FWS = self.LWS + self.CR
         self.atomends = self.specials + self.LWS + self.CR
         # Note that RFC 2822 now specifies `.' as obs-phrase, meaning that it
         # is obsolete syntax.  RFC 2822 requires that we recognize obsolete
@@ -418,7 +419,7 @@
         plist = []
 
         while self.pos < len(self.field):
-            if self.field[self.pos] in self.LWS:
+            if self.field[self.pos] in self.FWS:
                 self.pos += 1
             elif self.field[self.pos] == '"':
                 plist.append(self.getquote())

Modified: trunk/tmda/TMDA/pythonlib/email/charset.py
===================================================================
--- trunk/tmda/TMDA/pythonlib/email/charset.py	2007-04-16 16:43:42 UTC (rev 2186)
+++ trunk/tmda/TMDA/pythonlib/email/charset.py	2007-04-26 20:29:55 UTC (rev 2187)
@@ -46,6 +46,7 @@
     'iso-8859-13': (QP,        QP,      None),
     'iso-8859-14': (QP,        QP,      None),
     'iso-8859-15': (QP,        QP,      None),
+    'iso-8859-16': (QP,        QP,      None),
     'windows-1252':(QP,        QP,      None),
     'viscii':      (QP,        QP,      None),
     'us-ascii':    (None,      None,    None),
@@ -81,6 +82,8 @@
     'latin-8': 'iso-8859-14',
     'latin_9': 'iso-8859-15',
     'latin-9': 'iso-8859-15',
+    'latin_10':'iso-8859-16',
+    'latin-10':'iso-8859-16',
     'cp949':   'ks_c_5601-1987',
     'euc_jp':  'euc-jp',
     'euc_kr':  'euc-kr',

Modified: trunk/tmda/TMDA/pythonlib/email/header.py
===================================================================
--- trunk/tmda/TMDA/pythonlib/email/header.py	2007-04-16 16:43:42 UTC (rev 2186)
+++ trunk/tmda/TMDA/pythonlib/email/header.py	2007-04-26 20:29:55 UTC (rev 2187)
@@ -39,7 +39,8 @@
   \?                    # literal ?
   (?P<encoded>.*?)      # non-greedy up to the next ?= is the encoded string
   \?=                   # literal ?=
-  ''', re.VERBOSE | re.IGNORECASE)
+  (?=[ \t]|$)           # whitespace or the end of the string
+  ''', re.VERBOSE | re.IGNORECASE | re.MULTILINE)
 
 # Field name regexp, including trailing colon, but not separating whitespace,
 # according to RFC 2822.  Character range is from tilde to exclamation mark.

Modified: trunk/tmda/TMDA/pythonlib/email/message.py
===================================================================
--- trunk/tmda/TMDA/pythonlib/email/message.py	2007-04-16 16:43:42 UTC (rev 2186)
+++ trunk/tmda/TMDA/pythonlib/email/message.py	2007-04-26 20:29:55 UTC (rev 2187)
@@ -238,7 +238,7 @@
             self.del_param('charset')
             self._charset = None
             return
-        if isinstance(charset, str):
+        if isinstance(charset, basestring):
             charset = email.charset.Charset(charset)
         if not isinstance(charset, email.charset.Charset):
             raise TypeError(charset)
@@ -756,7 +756,9 @@
                 charset = charset[2]
         # charset character must be in us-ascii range
         try:
-            charset = unicode(charset, 'us-ascii').encode('us-ascii')
+            if isinstance(charset, str):
+                charset = unicode(charset, 'us-ascii')
+            charset = charset.encode('us-ascii')
         except UnicodeError:
             return failobj
         # RFC 2046, $4.1.2 says charsets are not case sensitive


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.