1 |
Author: zmedico |
2 |
Date: 2009-04-30 06:52:39 +0000 (Thu, 30 Apr 2009) |
3 |
New Revision: 13440 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.6/pym/portage/mail.py |
7 |
Log: |
8 |
Bug #263370 - In create_message(), use email.header.Header to wrap the |
9 |
subject, as a workaround so that long subject lines are wrapped correctly |
10 |
by <=python-2.6 (gentoo bug #263370, python issue #1974). (trunk r13261) |
11 |
|
12 |
Modified: main/branches/2.1.6/pym/portage/mail.py |
13 |
=================================================================== |
14 |
--- main/branches/2.1.6/pym/portage/mail.py 2009-04-30 06:51:30 UTC (rev 13439) |
15 |
+++ main/branches/2.1.6/pym/portage/mail.py 2009-04-30 06:52:39 UTC (rev 13440) |
16 |
@@ -7,6 +7,7 @@ |
17 |
from email.MIMEText import MIMEText as TextMessage |
18 |
from email.MIMEMultipart import MIMEMultipart as MultipartMessage |
19 |
from email.MIMEBase import MIMEBase as BaseMessage |
20 |
+from email.header import Header |
21 |
|
22 |
def create_message(sender, recipient, subject, body, attachments=None): |
23 |
if attachments == None: |
24 |
@@ -25,7 +26,9 @@ |
25 |
mymessage.set_unixfrom(sender) |
26 |
mymessage["To"] = recipient |
27 |
mymessage["From"] = sender |
28 |
- mymessage["Subject"] = subject |
29 |
+ # Use Header as a workaround so that long subject lines are wrapped |
30 |
+ # correctly by <=python-2.6 (gentoo bug #263370, python issue #1974). |
31 |
+ mymessage["Subject"] = Header(subject) |
32 |
mymessage["Date"] = time.strftime("%a, %d %b %Y %H:%M:%S %z") |
33 |
|
34 |
return mymessage |