diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 211: fix job page for jobs with no log file (as opposed to a missing log file)

Message ID 20120917025711.2888.18307.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson Sept. 17, 2012, 2:57 a.m. UTC
------------------------------------------------------------
revno: 211
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Mon 2012-09-17 14:56:42 +1200
message:
  fix job page for jobs with no log file (as opposed to a missing log file)
modified:
  lava_scheduler_app/views.py


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_scheduler_app/views.py'
--- lava_scheduler_app/views.py	2012-08-26 23:52:54 +0000
+++ lava_scheduler_app/views.py	2012-09-17 02:56:42 +0000
@@ -490,10 +490,11 @@ 
     }
 
     log_file = job.log_file
-    try:
-        log_file.open()
-    except IOError:
-        log_file = None
+    if log_file:
+        try:
+            log_file.open()
+        except IOError:
+            log_file = None
 
     if log_file:
         job_errors = getDispatcherErrors(log_file)
@@ -525,10 +526,11 @@ 
 def job_definition(request, pk):
     job = get_restricted_job(request.user, pk)
     log_file = job.log_file
-    try:
-        log_file.open()
-    except IOError:
-        log_file = None
+    if log_file:
+        try:
+            log_file.open()
+        except IOError:
+            log_file = None
     return render_to_response(
         "lava_scheduler_app/job_definition.html",
         {