Initial port to python3
[htsworkflow.git] / htsworkflow / frontend / experiments / views.py
index 5d4283da67288868b1e2a0bd0fd26bcfc78a3435..8171e981e58a36edfe7fe431c6d50c14b036b25a 100644 (file)
@@ -85,16 +85,16 @@ def startedEmail(request, pk):
             warnings.append((user.admin_url(), user.username))
     user=None
 
-    for user_email in email_lane.keys():
+    for user_email in list(email_lane.keys()):
         sending = ""
         # build body
         context = RequestContext(request,
-                                 {u'flowcell': fc,
-                                  u'lanes': email_lane[user_email],
-                                  u'runfolder': 'blank',
-                                  u'finish_low': estimate_low,
-                                  u'finish_high': estimate_high,
-                                  u'now': datetime.now(),
+                                 {'flowcell': fc,
+                                  'lanes': email_lane[user_email],
+                                  'runfolder': 'blank',
+                                  'finish_low': estimate_low,
+                                  'finish_high': estimate_high,
+                                  'now': datetime.now(),
                                   })
 
         # build view
@@ -103,9 +103,15 @@ def startedEmail(request, pk):
 
         if send:
             email = EmailMessage(subject, body, sender, to=[user_email])
+            notified = set()
             if bcc_managers:
-                email.bcc = settings.MANAGERS
-            email.bcc = settings.NOTIFICATION_BCC
+                for manager in settings.MANAGERS:
+                    if len(manager) > 0:
+                        notified.add(manager)
+            for user in settings.NOTIFICATION_BCC:
+                if len(user) > 0:
+                    notified.add(user)
+            email.bcc = list(notified)
             email.send()
 
         emails.append((user_email, subject, body, sending))