Preserve previous usage of MIMEText constructor under python2, since it's
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Nov 2009 06:46:12 +0000 (06:46 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Nov 2009 06:46:12 +0000 (06:46 -0000)
known to work this way.

svn path=/main/trunk/; revision=14807

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):