@task()
@timeit
def send_award_notification(award):
 @email_utils.safe_translation
 def _make_mail(locale, context, email):
  subject = _(u"You were awarded the '{title}' badge!").format(title=pgettext('DB: badger.Badge.title', award.badge.title))
  mail = email_utils.make_mail(subject=subject, text_template='kbadge/email/award_notification.ltxt', html_template='kbadge/email/award_notification.html', context_vars=context, from_email=settings.DEFAULT_FROM_EMAIL, to_email=email)
  return mail
 msg = _make_mail(locale=award.user.profile.locale, context={'host': Site.objects.get_current().domain, 'award': award, 'badge': award.badge}, email=award.user.email)
 email_utils.send_messages([msg])

@ task ( ) @ timeit def send_award_notification ( award ) : @ email_utils . safe_translation def _make_mail ( locale , context , email ) : subject = _ ( u"You were awarded the '{title}' badge!" ) . format ( title = pgettext ( 'DB: badger.Badge.title' , award . badge . title ) ) mail = email_utils . make_mail ( subject = subject , text_template = 'kbadge/email/award_notification.ltxt' , html_template = 'kbadge/email/award_notification.html' , context_vars = context , from_email = settings . DEFAULT_FROM_EMAIL , to_email = email ) return mail msg = _make_mail ( locale = award . user . profile . locale , context = { 'host' : Site . objects . get_current ( ) . domain , 'award' : award , 'badge' : award . badge } , email = award . user . email ) email_utils . send_messages ( [ msg ] )
sends the award notification email :arg award: the django-badger award instance .