Skip to content

Commit

Permalink
Merge pull request #4 from philippeowagner/master
Browse files Browse the repository at this point in the history
User is None (and there will be no valid email address) if the customer ...
  • Loading branch information
mbrochh committed Oct 6, 2013
2 parents 1a27a5c + 9aeca39 commit ab07252
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions shop_simplenotifications/models.py
Expand Up @@ -51,19 +51,20 @@ def payment_instructions_email_notification(sender, **kwargs):
'shop_simplenotifications/payment_instructions_body.txt'
request = kwargs.get('request')
order = kwargs.get('order')
subject = loader.render_to_string(
subject_template_name,
RequestContext(request, {'order': order})
)
subject = subject.join(subject.splitlines())
body = loader.render_to_string(
body_template_name,
RequestContext(request, {'order': order})
)
from_email = getattr(settings, 'SN_FROM_EMAIL',
settings.DEFAULT_FROM_EMAIL)
send_mail(subject, body, from_email,
[order.user.email,], fail_silently=False)
if order.user and order.user.email:
subject = loader.render_to_string(
subject_template_name,
RequestContext(request, {'order': order})
)
subject = subject.join(subject.splitlines())
body = loader.render_to_string(
body_template_name,
RequestContext(request, {'order': order})
)
from_email = getattr(settings, 'SN_FROM_EMAIL',
settings.DEFAULT_FROM_EMAIL)
send_mail(subject, body, from_email,
[order.user.email,], fail_silently=False)

confirmed.connect(payment_instructions_email_notification)

0 comments on commit ab07252

Please sign in to comment.