From 4bed54db77464c13f3fc059997286cd9c06562da Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 31 Mar 2009 16:46:32 +0000 Subject: Bug #263370 - In create_message(), use email.header.Header to wrap the subject, as a workaround so that long subject lines are wrapped correctly by <=python-2.6 (gentoo bug #263370, python issue #1974). svn path=/main/trunk/; revision=13261 --- pym/portage/mail.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pym/portage/mail.py b/pym/portage/mail.py index 72b411264..5f1cc11a6 100644 --- a/pym/portage/mail.py +++ b/pym/portage/mail.py @@ -7,6 +7,7 @@ import portage.exception, socket, smtplib, os, sys, time from email.MIMEText import MIMEText as TextMessage from email.MIMEMultipart import MIMEMultipart as MultipartMessage from email.MIMEBase import MIMEBase as BaseMessage +from email.header import Header def create_message(sender, recipient, subject, body, attachments=None): if attachments == None: @@ -25,7 +26,9 @@ def create_message(sender, recipient, subject, body, attachments=None): mymessage.set_unixfrom(sender) mymessage["To"] = recipient mymessage["From"] = sender - mymessage["Subject"] = subject + # Use Header as a workaround so that long subject lines are wrapped + # correctly by <=python-2.6 (gentoo bug #263370, python issue #1974). + mymessage["Subject"] = Header(subject) mymessage["Date"] = time.strftime("%a, %d %b %Y %H:%M:%S %z") return mymessage -- cgit v1.2.3-1-g7c22