Closed daxtens closed 9 years ago
need this!
:+1:
I've just added couple of small updates with differences I missed regarding dicts vs objs - thanks @japsu.
Thanks! want to see in the master branch
Please merge this, because Celery advocates to not using Pickle anymore (for safety reasons), and it breaks when using JSON
@pmclanahan bugging you again to merge this
Wow! Thanks for the ping. Somehow I apparently had my notifications messed up and I never saw this. I'm so sorry everyone! I've been a horrible maintainer. I'll get this merged and cut a new release today.
This supports the use of Celery's JSON serializer, which improves the security of Celery.
Prior to this patch, attempting to use Celery with the JSON serialization (as opposed to pickling) generated error messages complaining that a
django.core.mail.EmailMessage
is not JSON serializable. This patch converts email messages to dictionaries which are JSON serializable.For those still using the
pickle
serializer, everything should continue to work the same.Caveat on JSON-serializing attachments
This patch copies the
attachments
property of EmailMessages without further processing. Per [https://docs.djangoproject.com/en/dev/topics/email/#emailmessage-objects](the Django docs on EmailMessage objects), attachments are:As I understand it, this means that attachments as
MIMEBase
instances will still fail, but the triples may succeed. My application doesn't send attachments at the moment, so I haven't tested this. If in the deep distant future I get the opportunity to test it I will extend the patch.Attachments will still work for those using pickling. In the mean time, this patch still enhances support for those using JSON - instead of everything failing, only a limited subset of things fail.