Opened 6 years ago

Closed 6 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, 6 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedBug
Version: 2.1master

comment:2 by Simon Charette, 6 years ago

Patch needs improvement: set

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

comment:3 by Denis Stebunov, 6 years ago

Patch needs improvement: unset

comment:4 by Simon Charette, 6 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Tim Graham, 6 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@…>, 6 years ago

Resolution: fixed
Status: newclosed

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