Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend can return None #2

Open
jsvaughan opened this issue Jul 17, 2014 · 3 comments
Open

Backend can return None #2

jsvaughan opened this issue Jul 17, 2014 · 3 comments

Comments

@jsvaughan
Copy link
Contributor

django_email_multibackend/backends.py", line 126, in send_messages
send_count += backend.send_messages(email_messages)
TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'

@tbarbugli
Copy link
Owner

what version of Django are you running?

@jsvaughan
Copy link
Contributor Author

1.4

@jsvaughan
Copy link
Contributor Author

def send_messages(self, email_messages):
    """
    Sends one or more EmailMessage objects and returns the number of email
    messages sent.
    """
    if not email_messages:
        return
    self._lock.acquire()
    try:
        new_conn_created = self.open()
        if not self.connection:
            # We failed silently on open().
            # Trying to send would be pointless.
            return
        num_sent = 0
        for message in email_messages:
            sent = self._send(message)
            if sent:
                num_sent += 1
        if new_conn_created:
            self.close()
    finally:
        self._lock.release()
    return num_sent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants