Skip to content

Commit

Permalink
Added a warning if no message notification template found in database
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Garel committed Nov 10, 2011
1 parent 89cc11c commit 7b594cf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions helpdesk/lib.py
Expand Up @@ -17,6 +17,9 @@
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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7b594cf

Please sign in to comment.