Initial port to python3
[htsworkflow.git] / htsworkflow / frontend / experiments / views.py
index d108cb533d9b24f452d93bfe6a4f062f2802291c..8171e981e58a36edfe7fe431c6d50c14b036b25a 100644 (file)
@@ -28,12 +28,6 @@ from htsworkflow.frontend.experiments.experiments import \
 
 def index(request):
     all_runs = DataRun.objects.order_by('-run_start_time')
-    #t = loader.get_template('experiments/index.html')
-    #c = Context({
-    #    'data_run_list': all_runs,
-    #})
-    #return HttpResponse(t.render(c))
-    # shortcut to the above module usage
     return render_to_response('experiments/index.html',{'data_run_list': all_runs})
 
 def detail(request, run_folder):
@@ -91,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
@@ -109,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.append(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))