Example #1
0
    def subscribe_author(self, email=False):
        from turbion.bits import watchlist

        watchlist.subscribe(
            self.created_by,
            'new_comment',
            post=self.post,
            email=email
        )
Example #2
0
    def process(self):
        action = self.cleaned_data["action"]
        post = self.cleaned_data["post"]

        if action == "subs":
            watchlist.subscribe(self.user, "new_comment", post=post)
        else:
            watchlist.unsubscribe(self.user, "new_comment", post=post)

        return action, post
Example #3
0
    def test_new_comment(self):
        watchlist.subscribe(
            self.user,
            'new_comment',
            self.post,
            email=True
        )

        comment = self._create_comment()
        watchlist.emit_event('new_comment', post=self.post, comment=comment)

        self.assertEqual(queue_len(), 1)
Example #4
0
    def publicate(self):
        from turbion.bits.blogs import signals
        from turbion.bits import watchlist

        self.published_on = datetime.now()

        self.save()

        watchlist.subscribe(self.created_by, 'new_comment', self, True)

        signals.post_published.send(
            sender=self.__class__,
            post=self
        )
Example #5
0
    def test_feed(self):
        sub = watchlist.subscribe(
            self.user,
            'new_comment',
            self.post,
            email=True
        )
        self.create_comment()

        self.login()

        response = self.client.get(
            reverse('turbion_watchlist_feed', args=('atom/%s/' % self.user.pk,))
        )

        self.assertEqual(response.status_code, http.HttpResponse.status_code)
Example #6
0
    def test_unsubscribe_view(self):
        sub = watchlist.subscribe(
            self.user,
            'new_comment',
            self.post,
            email=True
        )

        site = Site.objects.get_current()
        url, data = sub.get_unsubscribe_url().split("?")

        response = self.client.get(url[len('http://' + site.domain):], dict(d.split('=') for d in data.split('&')))

        self.assertEqual(response.status_code, http.HttpResponseRedirect.status_code)

        self.assertEqual(Subscription.objects.count(), 0)