[Erp5-report] r21200 - /erp5/trunk/products/ERP5Type/patches/MailTemplates.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed May 28 16:40:14 CEST 2008
Author: yusei
Date: Wed May 28 16:40:11 2008
New Revision: 21200
URL: http://svn.erp5.org?rev=21200&view=rev
Log:
Remove newline at the end of mail body.
Encode subject header.
Modified:
erp5/trunk/products/ERP5Type/patches/MailTemplates.py
Modified: erp5/trunk/products/ERP5Type/patches/MailTemplates.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/MailTemplates.py?rev=21200&r1=21199&r2=21200&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/MailTemplates.py (original)
+++ erp5/trunk/products/ERP5Type/patches/MailTemplates.py Wed May 28 16:40:11 2008
@@ -15,6 +15,8 @@
except ImportError:
BaseMailTemplate = None
+from email.Header import make_header
+
if BaseMailTemplate is not None:
def _process_utf8(self,kw):
# sort out what encoding we're going to use
@@ -22,6 +24,10 @@
self.getProperty('encoding',
BaseMailTemplate.default_encoding))
text = self.__class__.__bases__[1].__call__(self,**kw)
+ # ZPT adds newline at the end, but it breaks backward compatibility.
+ # So I remove it.
+ if text and text[-1]=='\n':
+ text = text[:-1]
if not self.html() and isinstance(text, unicode):
text = text.encode(encoding,'replace')
# now turn the result into a MIMEText object
@@ -59,6 +65,8 @@
# make sure we have no unicode headers
if isinstance(value,unicode):
value = value.encode(encoding)
+ if key=='subject':
+ value = make_header([(value, 'utf-8')]).encode()
headers[header]=value
# check required values have been supplied
errors = []
More information about the Erp5-report
mailing list