Preserve previous usage of MIMEText constructor under python2, since it's
authorZac Medico <zmedico@gentoo.org>
Mon, 16 Nov 2009 00:30:24 +0000 (00:30 -0000)
committerZac Medico <zmedico@gentoo.org>
Mon, 16 Nov 2009 00:30:24 +0000 (00:30 -0000)
known to work this way. (trunk r14807)

svn path=/main/branches/2.1.7/; revision=14830

pym/portage/mail.py

index 64774cdacbe3f8266e9c0b4d34d79503183e998d..96bb38e833a60d752fc195dccfe6d6087fbb3150 100644 (file)
@@ -21,8 +21,11 @@ import portage
 if sys.hexversion >= 0x3000000:
        basestring = str
 
-def TextMessage(_text):
-       return MIMEText(_text, _charset="UTF-8")
+if sys.hexversion >= 0x3000000:
+       def TextMessage(_text):
+               return MIMEText(_text, _charset="UTF-8")
+else:
+       TextMessage = MIMEText
 
 def create_message(sender, recipient, subject, body, attachments=None):