Skip to content

HTTPS clone URL

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…

…tion.

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/base.py
  2. +2 −2 notification/backends/email.py
View
3  notification/backends/base.py
@@ -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):
View
4 notification/backends/email.py
@@ -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 user.email:
+ can_send = super(EmailBackend, self).can_send(user, notice_type)
+ if can_send and user.email:
return True
return False
Please sign in to comment.
Something went wrong with that request. Please try again.