commit:     a14d1493716ee0b026dc56ef6c6c1f24169fd880
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 12 21:24:08 2014 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Sep 12 21:24:08 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=a14d1493

portage/mail.py: don't encode Date header to bytes

As reported in bug #520752 comment #4, the _unicode_encode usage
triggers the following error with python 3.3.5:

        'bytes' object has no attribute 'encode'"

The _unicode_encode call is not needed for python2.x, since formatdate
returns bytes for python2.x.

Fixes: 7204b87040ed ("portage/mail.py: Make email date, timestamp RFC-compliant 
Bug 520752")
X-Gentoo-Bug: 520752
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=520752

---
 pym/portage/mail.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/pym/portage/mail.py b/pym/portage/mail.py
index 945cccd..11923ee 100644
--- a/pym/portage/mail.py
+++ b/pym/portage/mail.py
@@ -91,8 +91,7 @@ def create_message(sender, recipient, subject, body, 
attachments=None):
        #    input_bytes = s.encode(input_charset, errors)
        #UnicodeEncodeError: 'ascii' codec can't encode characters in position 
0-9: ordinal not in range(128)
        mymessage["Subject"] = Header(_force_ascii_if_necessary(subject))
-       mymessage["Date"] = _unicode_encode(formatdate(localtime=True),
-               encoding=_encodings['content'], errors='backslashreplace')
+       mymessage["Date"] = formatdate(localtime=True)
 
        return mymessage
 

Reply via email to