Opened 8 years ago

Closed 8 years ago

#30058 closed Bug (fixed)

Make SMTP EmailBackend.send_messages() return 0 rather than None for empty/error cases

Reported by: Denis Stebunov Owned by: nobody
Component: Core (Mail) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In its current version, EmailBackend.send_messages() would return None if no messages were sent due to a connection error, or a number of sent messages otherwise.

The proposal is to return 0 instead of None so that this method always returns an integer. As far as I can see, other built-in email backends in Django always return an integer.

PR available: ​https://github.com/django/django/pull/10784

Change History (6)

comment:1 by Simon Charette, 8 years ago

Triage Stage: Unreviewed → Accepted
Type: Uncategorized → Bug
Version: 2.1 → master

comment:2 by Simon Charette, 8 years ago

Patch needs improvement: set

It's missing a regression test for the not email_messages case.

comment:3 by Denis Stebunov, 8 years ago

Patch needs improvement: unset

comment:4 by Simon Charette, 8 years ago

Triage Stage: Accepted → Ready for checkin

comment:5 by Tim Graham, 8 years ago

Summary: Consistent return values for SMTP EmailBackend.send_messages() → Make SMTP EmailBackend.send_messages() return 0 rather than None for empty/error cases

comment:6 by Tim Graham <timograham@…>, 8 years ago

Resolution: → fixed
Status: new → closed

In 277de229:

Fixed #30058 -- Made SMTP EmailBackend.send_messages() return 0 for empty/error cases.

Note: See TracTickets for help on using tickets.
Back to Top