Skip to content

Commit

Permalink
stop trying to store connections in the db
Browse files Browse the repository at this point in the history
  • Loading branch information
davidszotten committed Jan 7, 2016
1 parent 0e59fed commit d3a2b31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mailer/engine.py
Expand Up @@ -133,6 +133,9 @@ def send_all():
# unpickled under Django 1.8
email.reply_to = []
email.send()

# connection can't be stored in the MessageLog
email.connection = None
message.email = email # For the sake of MessageLog
MessageLog.objects.log(message, RESULT_SUCCESS)
sent += 1
Expand Down
6 changes: 6 additions & 0 deletions mailer/tests.py
Expand Up @@ -15,10 +15,16 @@
import time


class FakeConnection(object):
def __getstate__(self):
raise TypeError("Connections can't be pickled")


class TestMailerEmailBackend(object):
outbox = []

def __init__(self, **kwargs):
self.connection = FakeConnection()
del self.outbox[:]

def open(self):
Expand Down

0 comments on commit d3a2b31

Please sign in to comment.