From e197cd6acca61823742d7d6816652a4a6c777bd1 Mon Sep 17 00:00:00 2001 From: Andromeda Yelton Date: Mon, 2 Apr 2012 15:04:51 -0400 Subject: [PATCH] now notifications actually get sent. cleanup to follow. --- core/signals.py | 8 +++----- .../templates/notification/active_campaign/full.txt | 10 +++------- .../templates/notification/active_campaign/notice.html | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/core/signals.py b/core/signals.py index 406a9020..92527b91 100644 --- a/core/signals.py +++ b/core/signals.py @@ -74,7 +74,7 @@ signals.post_syncdb.connect(create_notice_types, sender=notification) # define the notifications and tie them to corresponding signals -from django.contrib.comments.signals import comment_was_posted +from django.contrib.comments.signals import comment_was_posted def notify_comment(comment, request, **kwargs): logger.info('comment %s notifying' % comment.pk) @@ -92,15 +92,13 @@ def notify_active_campaign(sender, **kwargs): # what sort of error handling do I need to do here? any? # how do I both ensure that the status is active AND that it was just made active? # do i need to send that with the signal? - # let's do the basic version for now and then ask for guidance on style, error-checking # logging? campaign = kwargs.get('instance') - print "i'm in ur function launchin ur "+campaign.name work = campaign.work # assumes only one active claim per campaign. safe? rightsholder = work.claim.filter(status="active")[0].rights_holder.rights_holder_name - # is this distinct? ungluers = work.wished_by() notification.queue(ungluers, "active_campaign", {'campaign':campaign, 'work':work, 'rightsholder':rightsholder}, True) - emit_notifications.delay() + import regluit.core.tasks as tasks + tasks.emit_notifications.delay() signals.post_save.connect(notify_active_campaign, sender=Campaign) diff --git a/frontend/templates/notification/active_campaign/full.txt b/frontend/templates/notification/active_campaign/full.txt index 0f5da311..4f83d639 100644 --- a/frontend/templates/notification/active_campaign/full.txt +++ b/frontend/templates/notification/active_campaign/full.txt @@ -2,15 +2,11 @@ Congratulations, you wished for it, and now there is an active Campaign for {{ w You can help! -{% comment %} -Pledge toward ungluing. +Pledge toward ungluing. -Tell your friends -- there are handy share options on the campaign page. There's even a widget you can put on your blog or home page. +Tell your friends -- there are handy share options on the campaign page. There's even a widget you can put on your blog or home page. -Join the discussion: share why you love {{ work.title }} and the world will too. - -i'm pretty sure the slashes are breaking the send -{% endcomment %} +Join the discussion: share why you love {{ work.title }} and the world will too. Thank you! diff --git a/frontend/templates/notification/active_campaign/notice.html b/frontend/templates/notification/active_campaign/notice.html index a5f40c8b..4c2d5386 100644 --- a/frontend/templates/notification/active_campaign/notice.html +++ b/frontend/templates/notification/active_campaign/notice.html @@ -1,6 +1,6 @@
- cover image for {{ work.title }} + cover image for {{ work.title }}