1 |
Author: zmedico |
2 |
Date: 2009-03-31 16:46:32 +0000 (Tue, 31 Mar 2009) |
3 |
New Revision: 13261 |
4 |
|
5 |
Modified: |
6 |
main/trunk/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). |
11 |
|
12 |
|
13 |
Modified: main/trunk/pym/portage/mail.py |
14 |
=================================================================== |
15 |
--- main/trunk/pym/portage/mail.py 2009-03-31 08:51:19 UTC (rev 13260) |
16 |
+++ main/trunk/pym/portage/mail.py 2009-03-31 16:46:32 UTC (rev 13261) |
17 |
@@ -7,6 +7,7 @@ |
18 |
from email.MIMEText import MIMEText as TextMessage |
19 |
from email.MIMEMultipart import MIMEMultipart as MultipartMessage |
20 |
from email.MIMEBase import MIMEBase as BaseMessage |
21 |
+from email.header import Header |
22 |
|
23 |
def create_message(sender, recipient, subject, body, attachments=None): |
24 |
if attachments == None: |
25 |
@@ -25,7 +26,9 @@ |
26 |
mymessage.set_unixfrom(sender) |
27 |
mymessage["To"] = recipient |
28 |
mymessage["From"] = sender |
29 |
- mymessage["Subject"] = subject |
30 |
+ # Use Header as a workaround so that long subject lines are wrapped |
31 |
+ # correctly by <=python-2.6 (gentoo bug #263370, python issue #1974). |
32 |
+ mymessage["Subject"] = Header(subject) |
33 |
mymessage["Date"] = time.strftime("%a, %d %b %Y %H:%M:%S %z") |
34 |
|
35 |
return mymessage |