def _mails(self, users_and_watches): c = {'post': self.post.content, 'author': self.post.author.username, 'host': Site.objects.get_current().domain, 'thread': self.post.thread.title, 'forum': self.post.thread.forum.name, 'post_url': self.post.thread.get_absolute_url()} return emails_with_users_and_watches( _lazy(u'{forum} - {thread}'), 'forums/email/new_thread.ltxt', c, users_and_watches)
def _mails(self, users_and_watches): c = {'post': self.post.content, 'author': self.post.author.username, 'host': Site.objects.get_current().domain, 'thread': self.post.thread.title, 'forum': self.post.thread.forum.name, 'post_url': self.post.thread.get_absolute_url()} return emails_with_users_and_watches( subject=_lazy(u'{forum} - {thread}'), text_template='forums/email/new_thread.ltxt', html_template=None, context_vars=c, users_and_watches=users_and_watches)
def _mails(self, users_and_watches): c = {'post': self.reply.content, 'author': self.reply.author.username, 'host': Site.objects.get_current().domain, 'thread': self.reply.thread.title, 'forum': self.reply.thread.forum.name, 'post_url': self.reply.get_absolute_url()} return emails_with_users_and_watches( subject=_lazy(u'Re: {forum} - {thread}'), text_template='forums/email/new_post.ltxt', html_template=None, context_vars=c, users_and_watches=users_and_watches)
def new_thread_mails(post, users_and_watches): """Return an interable of EmailMessages to send when a new thread is created.""" c = {'post': post.content, 'author': post.creator.username, 'host': Site.objects.get_current().domain, 'thread': post.thread.title, 'forum': post.thread.document.title, 'post_url': post.thread.get_absolute_url()} return emails_with_users_and_watches( _lazy(u'{forum} - {thread}'), 'kbforums/email/new_thread.ltxt', c, users_and_watches)
def new_post_mails(reply, users_and_watches): """Return an interable of EmailMessages to send when a new post is created.""" c = {'post': reply.content, 'author': reply.creator.username, 'host': Site.objects.get_current().domain, 'thread': reply.thread.title, 'forum': reply.thread.document.title, 'post_url': reply.get_absolute_url()} return emails_with_users_and_watches( subject=_lazy(u'Re: {forum} - {thread}'), text_template='kbforums/email/new_post.ltxt', html_template=None, context_vars=c, users_and_watches=users_and_watches)
def new_thread_mails(post, users_and_watches): """Return an interable of EmailMessages to send when a new thread is created.""" c = { 'post': post.content, 'author': post.creator.username, 'host': Site.objects.get_current().domain, 'thread': post.thread.title, 'forum': post.thread.document.title, 'post_url': post.thread.get_absolute_url() } return emails_with_users_and_watches( subject=_lazy(u'{forum} - {thread}'), text_template='kbforums/email/new_thread.ltxt', html_template=None, context_vars=c, users_and_watches=users_and_watches)
def test_styles_inlining(self): """Test that styles tags are converted to inline styles""" with patch('jingo.render_to_string') as mocked: mocked.return_value = ('<html>' '<head>' '<style>a { color: #000; }</style>' '</head>' '<body>' '<a href="/test">Hyperlink</a>' '</body>' '</html>') u = user(save=True) msg = emails_with_users_and_watches('test', 'a.ltxt', 'a.html', {}, [(u, [None])]) for m in msg: tag = ('<a href="https://%s/test" style="color:#000">' 'Hyperlink</a>') self.assertIn(tag % Site.objects.get_current().domain, str(m.message()))
def _mails(self, users_and_watches): revision = self.revision document = revision.document log.debug('Sending edited notification email for document (id=%s)' % document.id) subject = _lazy(u'{title} was edited by {creator}') url = reverse('wiki.document_revisions', locale=document.locale, args=[document.slug]) context = context_dict(revision) context['url'] = url context['locale'] = document.locale context['title'] = document.title context['creator'] = revision.creator return email_utils.emails_with_users_and_watches( subject, 'wiki/email/edited.ltxt', context, users_and_watches, default_locale=document.locale)
def _mails(self, users_and_watches): """Send readiness mails. """ revision = self.revision document = revision.document log.debug('Sending ready notifications for revision (id=%s)' % revision.id) subject = _lazy(u'{title} has a revision ready for localization') context = context_dict(revision, ready_for_l10n=True) context['url'] = django_reverse('wiki.select_locale', args=[document.slug]) context['title'] = document.title return email_utils.emails_with_users_and_watches( subject, 'wiki/email/ready_for_l10n.ltxt', context, users_and_watches, default_locale=document.locale)
def _mails(self, users_and_watches): """Send readiness mails. """ revision = self.revision document = revision.document log.debug('Sending ready notifications for revision (id=%s)' % revision.id) subject = _lazy(u'{title} has a revision ready for localization') context = context_dict(revision, ready_for_l10n=True) context['l10n_url'] = django_reverse('wiki.select_locale', args=[document.slug]) context['title'] = document.title return email_utils.emails_with_users_and_watches( subject=subject, text_template='wiki/email/ready_for_l10n.ltxt', html_template='wiki/email/ready_for_l10n.html', context_vars=context, users_and_watches=users_and_watches, default_locale=document.locale)
def _mails(self, users_and_watches): revision = self.revision document = revision.document log.debug('Sending ready for review email for revision (id=%s)' % revision.id) subject = _lazy(u'{title} is ready for review ({creator})') url = reverse('wiki.review_revision', locale=document.locale, args=[document.slug, revision.id]) context = context_dict(revision) context['revision_url'] = url context['locale'] = document.locale context['title'] = document.title context['creator'] = revision.creator return email_utils.emails_with_users_and_watches( subject=subject, text_template='wiki/email/ready_for_review.ltxt', html_template='wiki/email/ready_for_review.html', context_vars=context, users_and_watches=users_and_watches, default_locale=document.locale)
def _mails(self, users_and_watches): revision = self.revision document = revision.document log.debug('Sending ready for review email for revision (id=%s)' % revision.id) subject = _lazy(u'{title} is ready for review ({creator})') url = reverse('wiki.review_revision', locale=document.locale, args=[document.slug, revision.id]) context = context_dict(revision) context['url'] = url context['locale'] = document.locale context['title'] = document.title context['creator'] = revision.creator return email_utils.emails_with_users_and_watches( subject, 'wiki/email/ready_for_review.ltxt', context, users_and_watches, default_locale=document.locale)
def _mails(self, users_and_watches): revision = self.revision document = revision.document log.debug('Sending edited notification email for document (id=%s)' % document.id) subject = _lazy(u'{title} was edited by {creator}') url = reverse('wiki.document_revisions', locale=document.locale, args=[document.slug]) context = context_dict(revision) context['revisions_url'] = url context['locale'] = document.locale context['title'] = document.title context['creator'] = revision.creator return email_utils.emails_with_users_and_watches( subject=subject, text_template='wiki/email/edited.ltxt', html_template='wiki/email/edited.html', context_vars=context, users_and_watches=users_and_watches, default_locale=document.locale)