construct notification handler

pull/1/head
Andromeda Yelton 2012-11-16 10:24:48 -05:00
parent 87da5ae50e
commit f25f3c81ee
1 changed files with 27 additions and 0 deletions

View File

@ -238,3 +238,30 @@ def handle_wishlist_added(supporter, work, **kwargs):
emit_notifications.delay()
wishlist_added.connect(handle_wishlist_added)
deadline_impending = Signal(providing_args["campaign"])
def handle_wishlist_near_deadline(campaign, **kwargs):
"""
send two groups - one the nonpledgers, one the pledgers
set the pledged flag differently in the context
"""
pledgers = campaign.supporters()
nonpledgers = campaign.work.wished_by().exclude(id__in=pledgers)
notification.queue(pledgers, "wishlist_near_deadline", {
'campaign': campaign,
'domain': settings.BASE_URL,
'pledged': True,
}, True)
notification.queue(nonpledgers, "wishlist_near_deadline", {
'campaign': campaign,
'domain': settings.BASE_URL,
'pledged': False,
}, True)
from regluit.core.tasks import emit_notifications
emit_notifications.delay()
deadline_impending.connect(handle_wishlist_near_deadline)