Issue #118: Incorrect handling of Locales on e-mail templates

This commit is contained in:
Ross Poulton 2009-10-13 10:25:24 +00:00
parent f418e97efc
commit ea1610e837
2 changed files with 7 additions and 1 deletions

View File

@ -9,3 +9,7 @@ to the Submitter. This is a work in progress.
Patch courtesy of david@zettazebra.com, adds the ability to add tags to
tickets if django-tagging is installed and in use. If django-tagging isn't
being used, no change is visible to the user.
2009-10-13 r141 Issue #118 Incorrect locale handling on email templates
Patch courtesy of hgeerts. Corrects the handling of locale on email
templaets, defaulting to English if no locale is provided.

4
lib.py
View File

@ -52,7 +52,9 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b
import os
context = Context(email_context)
locale = getattr(context['queue'], 'locale', 'en')
locale = getattr(context['queue'], 'locale', '')
if not locale:
locale = 'en'
if locale:
template_localized = template_name + ':' + locale