Esempio n. 1
0
    def mail_subscribers(self):
        mail_queue = []

        subscribers = EmailSubscriber.current_objects.all()

        domain = get_site_domain()

        for subscriber in subscribers:
            mail_queue.append(self.generate_mail(subscriber, domain))

        connection = mail.get_connection()

        connection.open()
        connection.send_messages(mail_queue)
        connection.close()

        return len(subscribers)
Esempio n. 2
0
    def mail_subscribers(self):
        mail_queue = []

        subscribers = EmailSubscriber.current_objects.all()

        domain = get_site_domain()

        seen_subscribers = set()

        for subscriber in subscribers:
            if subscriber.email in seen_subscribers:
                continue

            mail_queue.append(self.generate_mail(subscriber, domain))
            seen_subscribers.add(subscriber.email)

        connection = mail.get_connection()

        connection.open()
        connection.send_messages(mail_queue)
        connection.close()

        return seen_subscribers
Esempio n. 3
0
    def mail_subscribers(self):
        mail_queue = []

        subscribers = EmailSubscriber.current_objects.all()

        domain = get_site_domain()

        seen_subscribers = set()

        for subscriber in subscribers:
            if subscriber.email in seen_subscribers:
                continue

            mail_queue.append(self.generate_mail(subscriber, domain))
            seen_subscribers.add(subscriber.email)

        connection = mail.get_connection()

        connection.open()
        connection.send_messages(mail_queue)
        connection.close()

        return seen_subscribers
Esempio n. 4
0
 def test_get_site_domain_configured(self):
     self.assertEqual(get_site_domain(), 'foobar.com')
Esempio n. 5
0
 def test_get_site_domain_unconfigured(self):
     with self.assertRaises(ImproperlyConfigured):
         get_site_domain()
Esempio n. 6
0
 def test_get_site_domain(self):
     self.assertEqual(get_site_domain(),
                      'www.example.com')
Esempio n. 7
0
 def unsubscribe_url(self):
     relative_url = reverse('tinyblog_unsubscribe')
     return u'http://{0}{1}'.format(get_site_domain(), relative_url)
Esempio n. 8
0
 def confirm_url(self):
     relative_url = reverse('tinyblog_subscribe_confirm',
                            args=[
                                self.uuid_second,
                            ])
     return u'http://{0}{1}'.format(get_site_domain(), relative_url)
Esempio n. 9
0
 def test_get_site_domain_configured(self):
     self.assertEqual(get_site_domain(), 'foobar.com')
Esempio n. 10
0
 def test_get_site_domain_unconfigured(self):
     with self.assertRaises(ImproperlyConfigured):
         get_site_domain()
Esempio n. 11
0
 def test_get_site_domain(self):
     self.assertEqual(get_site_domain(), 'www.example.com')
Esempio n. 12
0
 def unsubscribe_url(self):
     relative_url = reverse('tinyblog_unsubscribe')
     return u'http://{0}{1}'.format(get_site_domain(), relative_url)
Esempio n. 13
0
 def confirm_url(self):
     relative_url = reverse('tinyblog_subscribe_confirm',
                            args=[self.uuid_second, ])
     return u'http://{0}{1}'.format(get_site_domain(), relative_url)