mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-14 18:18:36 +02:00
pycodestyle formatting
This commit is contained in:
@ -58,12 +58,15 @@ def send_templated_mail(template_name,
|
||||
locale = context['queue'].get('locale') or HELPDESK_EMAIL_FALLBACK_LOCALE
|
||||
|
||||
try:
|
||||
t = EmailTemplate.objects.get(template_name__iexact=template_name, locale=locale)
|
||||
t = EmailTemplate.objects.get(
|
||||
template_name__iexact=template_name, locale=locale)
|
||||
except EmailTemplate.DoesNotExist:
|
||||
try:
|
||||
t = EmailTemplate.objects.get(template_name__iexact=template_name, locale__isnull=True)
|
||||
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)
|
||||
logger.warning(
|
||||
'template "%s" does not exist, no mail sent', template_name)
|
||||
return # just ignore if template doesn't exist
|
||||
|
||||
subject_part = from_string(
|
||||
@ -77,10 +80,12 @@ def send_templated_mail(template_name,
|
||||
"%s\n\n{%% include '%s' %%}" % (t.plain_text, footer_file)
|
||||
).render(context)
|
||||
|
||||
email_html_base_file = os.path.join('helpdesk', locale, 'email_html_base.html')
|
||||
email_html_base_file = os.path.join(
|
||||
'helpdesk', locale, 'email_html_base.html')
|
||||
# keep new lines in html emails
|
||||
if 'comment' in context:
|
||||
context['comment'] = mark_safe(context['comment'].replace('\r\n', '<br>'))
|
||||
context['comment'] = mark_safe(
|
||||
context['comment'].replace('\r\n', '<br>'))
|
||||
|
||||
html_part = from_string(
|
||||
"{%% extends '%s' %%}"
|
||||
@ -112,7 +117,8 @@ def send_templated_mail(template_name,
|
||||
try:
|
||||
return msg.send()
|
||||
except SMTPException as e:
|
||||
logger.exception('SMTPException raised while sending email to {}'.format(recipients))
|
||||
logger.exception(
|
||||
'SMTPException raised while sending email to {}'.format(recipients))
|
||||
if not fail_silently:
|
||||
raise e
|
||||
return 0
|
||||
|
Reference in New Issue
Block a user