|
|
|
|
@ -320,7 +320,7 @@ class NewsLetterSender(object): |
|
|
|
|
return smart_unicode(content) |
|
|
|
|
|
|
|
|
|
def build_preheader_ctx(self, contact): |
|
|
|
|
t_add = '' |
|
|
|
|
t_add = u'' |
|
|
|
|
count = contact.contactsettings.theme.count() |
|
|
|
|
if count > 3: |
|
|
|
|
count -= 3 |
|
|
|
|
@ -331,7 +331,7 @@ class NewsLetterSender(object): |
|
|
|
|
) |
|
|
|
|
self.preheader_ctx = { |
|
|
|
|
'name': contact.first_name or contact.last_name or _(u'Подписчик'), |
|
|
|
|
'themes': ', '.join([self.themes.get(x) for x in contact.contactsettings.theme.all().values_list('pk', flat=True)[:3]]) + t_add, |
|
|
|
|
'themes': u', '.join([self.themes.get(x) for x in contact.contactsettings.theme.all().values_list('pk', flat=True)[:3]]) + t_add, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
def update_newsletter_status(self): |
|
|
|
|
@ -478,7 +478,7 @@ class Mailer(NewsLetterSender): |
|
|
|
|
if self.announce and not announce_context: |
|
|
|
|
send = False |
|
|
|
|
try: |
|
|
|
|
log.info('Trying send to {email}'.format(email=contact.email)) |
|
|
|
|
log.info(u'Trying send to {email}'.format(email=contact.email)) |
|
|
|
|
# pass |
|
|
|
|
if send: |
|
|
|
|
message = self.build_message(contact, announce_context) |
|
|
|
|
@ -487,7 +487,7 @@ class Mailer(NewsLetterSender): |
|
|
|
|
message.as_string()) |
|
|
|
|
except (Exception, ) as e: |
|
|
|
|
exception = e |
|
|
|
|
log.info('Exception was raised while sending to {email}: {exception}'.format( |
|
|
|
|
log.info(u'Exception was raised while sending to {email}: {exception}'.format( |
|
|
|
|
email=contact.email, exception=exception)) |
|
|
|
|
else: |
|
|
|
|
exception = None |
|
|
|
|
|