Forráskód Böngészése

fix UnicodeEncodeError when sending email contains unicode characters.

Seong Won Mun 13 éve
szülő
commit
012d449d19
1 módosított fájl, 3 hozzáadás és 1 törlés
  1. 3 1
      celery/loaders/base.py

+ 3 - 1
celery/loaders/base.py

@@ -24,6 +24,7 @@ from ..exceptions import ImproperlyConfigured
 from ..utils import (cached_property, get_cls_by_name,
                      import_from_cwd as _import_from_cwd)
 from ..utils.functional import maybe_list
+from ..utils.encoding import safe_str
 
 BUILTIN_MODULES = frozenset(["celery.task"])
 
@@ -182,7 +183,8 @@ class BaseLoader(object):
             use_ssl=False, use_tls=False):
         try:
             message = self.mail.Message(sender=sender, to=to,
-                                        subject=subject, body=body)
+                                        subject=safe_str(subject),
+                                        body=safe_str(body))
             mailer = self.mail.Mailer(host=host, port=port,
                                       user=user, password=password,
                                       timeout=timeout, use_ssl=use_ssl,