Added a warning if no message notification template found in database

This commit is contained in:
Alex Garel 2011-11-10 12:19:57 +01:00
parent 89cc11cb8e
commit 7b594cfdc0

View File

@ -17,6 +17,9 @@ try:
except ImportError:
from base64 import decodestring as b64decode
import logging
logger = logging.getLogger('helpdesk')
from django.utils.encoding import smart_str
def send_templated_mail(template_name, email_context, recipients, sender=None, bcc=None, fail_silently=False, files=None):
@ -66,6 +69,8 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b
try:
t = EmailTemplate.objects.get(template_name__iexact=template_name, locale__isnull=True)
except EmailTemplate.DoesNotExist:
logger.warning('template "%s" does not exist, no mail sent' %
template_name)
return # just ignore if template doesn't exist
if not sender: