Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@email_utils.safe_translation
def _make_mail(locale, user, watches):
if (is_ready and
ReadyRevisionEvent.event_type in
(w.event_type for w in watches)):
c = context_dict(revision, ready_for_l10n=True)
# TODO: Expose all watches
c['watch'] = watches[0]
c['l10n_url'] = django_reverse('wiki.select_locale',
args=[document.slug])
subject = _(u'{title} has a revision ready for '
'localization')
text_template = 'wiki/email/ready_for_l10n.ltxt'
html_template = 'wiki/email/ready_for_l10n.html'
else:
html_template='wiki/email/reviewed.html',
context_vars=c,
from_email=settings.TIDINGS_FROM_ADDRESS,
to_email=user.email)
msgs.append(mail)
for user in [revision.creator, revision.reviewer]:
if hasattr(user, 'profile'):
locale = user.profile.locale
else:
locale = settings.WIKI_DEFAULT_LANGUAGE
_make_mail(locale, user)
email_utils.send_messages(msgs)
@email_utils.safe_translation
def _make_mail(locale):
subject = _('Please confirm your email address')
context = {
'activation_url': cls._activation_url(watch),
'domain': Site.objects.get_current().domain,
'watch_description': cls.description_of_watch(watch)}
mail = email_utils.make_mail(
subject=subject,
text_template='questions/email/activate_watch.ltxt',
html_template='questions/email/activate_watch.html',
context_vars=context,
from_email=settings.TIDINGS_FROM_ADDRESS,
to_email=email)
return mail
@email_utils.safe_translation
def _make_mail(locale):
mail = email_utils.make_mail(
subject=subject,
text_template=text_template,
html_template=html_template,
context_vars=c,
from_email=from_email,
to_email=user.email)
return mail