pmclanahan / django-celery-email

A Django email backend that uses a celery task for sending the email.
BSD 3-Clause "New" or "Revised" License
477 stars 108 forks source link

Documentation: Add pickle serializer requirement #8

Closed andresriancho closed 8 years ago

andresriancho commented 10 years ago

Add documentation text explaining that this module only works if the CELERY_TASK_SERIALIZER is pickle. Otherwise the pickling of email messages fails:

>>> from django.core.mail import EmailMessage
>>> e = EmailMessage('a', 'b', 'c@d.com')
>>> import json
>>> json.dumps(e)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/lib/python2.7/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 201, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python2.7/json/encoder.py", line 264, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python2.7/json/encoder.py", line 178, in default
    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: <django.core.mail.message.EmailMessage object at 0x3f95c10> is not JSON serializable
>>> 
andresriancho commented 10 years ago

Or even better, merge these changes where it is fixed

andresriancho commented 10 years ago

Or even better, my fork which supports HTML email https://github.com/andresriancho/django-celery-email/commits/master