From 12063d1e7813a05fc351efc00aaba17f747d4df9 Mon Sep 17 00:00:00 2001 From: Dan Moore Date: Tue, 11 Jun 2024 09:19:26 -0400 Subject: [PATCH] Make all default `send_*` funcs return result of `.send()` (#277) Right now 2 implicitly return this already, and 2 explicitly only return `True` if it gets that far. Note that the `modeled.ModelInvitation`'s version already does exactly this explicitly. --- src/organizations/backends/defaults.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/organizations/backends/defaults.py b/src/organizations/backends/defaults.py index ab3c8d3..18571f8 100644 --- a/src/organizations/backends/defaults.py +++ b/src/organizations/backends/defaults.py @@ -128,7 +128,7 @@ def send_reminder(self, user, sender=None, **kwargs): return False token = PasswordResetTokenGenerator().make_token(user) kwargs.update({"token": token}) - self.email_message( + return self.email_message( user, self.reminder_subject, self.reminder_body, sender, **kwargs ).send() @@ -230,7 +230,7 @@ def send_activation(self, user, sender=None, **kwargs): return False token = self.get_token(user) kwargs.update({"token": token}) - self.email_message( + return self.email_message( user, self.activation_subject, self.activation_body, sender, **kwargs ).send() @@ -337,10 +337,9 @@ def send_invitation(self, user, sender=None, **kwargs): return False token = self.get_token(user) kwargs.update({"token": token}) - self.email_message( + return self.email_message( user, self.invitation_subject, self.invitation_body, sender, **kwargs ).send() - return True def send_notification(self, user, sender=None, **kwargs): """ @@ -350,7 +349,6 @@ def send_notification(self, user, sender=None, **kwargs): """ if not user.is_active: return False - self.email_message( + return self.email_message( user, self.notification_subject, self.notification_body, sender, **kwargs ).send() - return True