Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Moved should_send function call to BaseBackend to reduce code duplica…


This change is backwards incompatible in the sense that if should_send changes
you may be affected.
  • Loading branch information...
commit 9d2da7ffb4834ae88e27d72c19e0c20eb7c44256 1 parent a48821f
@brosner brosner authored
Showing with 5 additions and 2 deletions.
  1. +3 −0  notification/backends/
  2. +2 −2 notification/backends/
3  notification/backends/
@@ -15,6 +15,9 @@ def can_send(self, user, notice_type):
Determines whether this backend is allowed to send a notification to
the given user and notice_type.
+ from notification.models import should_send
+ if should_send(user, notice_type, self.medium_id):
+ return True
return False
def deliver(self, recipient, notice_type, extra_context):
4 notification/backends/
@@ -20,8 +20,8 @@ class EmailBackend(backends.BaseBackend):
spam_sensitivity = 2
def can_send(self, user, notice_type):
- from notification.models import should_send
- if should_send(user, notice_type, self.medium_id) and
+ can_send = super(EmailBackend, self).can_send(user, notice_type)
+ if can_send and
return True
return False
Please sign in to comment.
Something went wrong with that request. Please try again.