Skip to content

Commit a77839d

Browse files
authored
Merge pull request #3270 from rtfd/fix-email-sending
Use json to test for celery serializing
2 parents 1b6860a + 2958824 commit a77839d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

readthedocs/core/adapters.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Allauth overrides"""
22

33
from __future__ import absolute_import
4-
import pickle
4+
import json
55
import logging
66

77
from allauth.account.adapter import DefaultAccountAdapter
@@ -32,12 +32,12 @@ def send_mail(self, template_prefix, email, context):
3232
subject = self.format_email_subject(subject)
3333

3434
# Allauth sends some additional data in the context, remove it if the
35-
# pieces can't be pickled
35+
# pieces can't be json encoded
3636
removed_keys = []
3737
for key in list(context.keys()):
3838
try:
39-
_ = pickle.dumps(context[key]) # noqa for F841
40-
except (pickle.PickleError, TypeError):
39+
_ = json.dumps(context[key]) # noqa for F841
40+
except (ValueError, TypeError):
4141
removed_keys.append(key)
4242
del context[key]
4343
if removed_keys:

0 commit comments

Comments
 (0)