fixed Issue 1456:encoding in mail.send, thanks Corne
This commit is contained in:
@@ -1 +1 @@
|
||||
Version 2.4.6-stable+timestamp.2013.04.15.22.57.21
|
||||
Version 2.4.6-stable+timestamp.2013.04.19.23.45.56
|
||||
|
||||
@@ -39,6 +39,7 @@ def user():
|
||||
return dict(form=auth())
|
||||
|
||||
|
||||
@cache.action()
|
||||
def download():
|
||||
"""
|
||||
allows downloading of uploaded files
|
||||
|
||||
+1
-1
@@ -437,7 +437,7 @@ class Cache(object):
|
||||
# been accounted for
|
||||
logger.warning('no cache.disk (AttributeError)')
|
||||
|
||||
def client(self, time_expire=DEFAULT_TIME_EXPIRE, cache_model=None,
|
||||
def action(self, time_expire=DEFAULT_TIME_EXPIRE, cache_model=None,
|
||||
prefix=None, session=False, vars=True, lang=True,
|
||||
user_agent=False, public=True, valid_statuses=None,
|
||||
quick=None):
|
||||
|
||||
+10
-6
@@ -412,16 +412,20 @@ class Mail(object):
|
||||
if (not text is None or not html is None) and (not raw):
|
||||
attachment = MIMEMultipart.MIMEMultipart('alternative')
|
||||
if not text is None:
|
||||
if isinstance(text, basestring):
|
||||
if not isinstance(text, basestring):
|
||||
text = text.read()
|
||||
if isinstance(text, unicode):
|
||||
text = text.encode('utf-8')
|
||||
elif not encoding=='utf-8':
|
||||
text = text.decode(encoding).encode('utf-8')
|
||||
else:
|
||||
text = text.read().decode(encoding).encode('utf-8')
|
||||
attachment.attach(MIMEText.MIMEText(text, _charset='utf-8'))
|
||||
if not html is None:
|
||||
if isinstance(html, basestring):
|
||||
if not isinstance(html, basestring):
|
||||
html = html.read()
|
||||
if isinstance(html, unicode):
|
||||
html = html.encode('utf-8')
|
||||
elif not encoding=='utf-8':
|
||||
html = html.decode(encoding).encode('utf-8')
|
||||
else:
|
||||
html = html.read().decode(encoding).encode('utf-8')
|
||||
attachment.attach(
|
||||
MIMEText.MIMEText(html, 'html', _charset='utf-8'))
|
||||
payload_in.attach(attachment)
|
||||
|
||||
Reference in New Issue
Block a user