mailer announce context fix

remotes/origin/stage5
Alexander Burdeiny 10 years ago
parent c15afb7ef0
commit a33aca03d0
  1. 7
      emencia/django/newsletter/mailer.py

@ -16,6 +16,8 @@ from pymorphy2 import MorphAnalyzer
morph = MorphAnalyzer() morph = MorphAnalyzer()
from logging import getLogger from logging import getLogger
log = getLogger('mail') log = getLogger('mail')
from itertools import chain
try: try:
from email.mime.multipart import MIMEMultipart from email.mime.multipart import MIMEMultipart
@ -207,11 +209,12 @@ class NewsLetterSender(object):
def build_announce_attachments(self, context): def build_announce_attachments(self, context):
# todo: move hardcoded prefixes to setting (uses in templates) # todo: move hardcoded prefixes to setting (uses in templates)
events = context['events'] conf = context.get('conf', [])
expo = context.get('expo', [])
news = context.get('news') news = context.get('news')
blogs = context.get('blogs') blogs = context.get('blogs')
attachments = [] attachments = []
for event in events: for event in chain(conf, expo):
message_attachment = self.gen_attachment_logo(event, prefix='mail_expo_logo_') message_attachment = self.gen_attachment_logo(event, prefix='mail_expo_logo_')
if message_attachment: if message_attachment:
attachments.append(message_attachment) attachments.append(message_attachment)

Loading…
Cancel
Save