[Branch,~linaro-validation/lava-scheduler/trunk] Rev 242: prefer getting the link from the results bundle rather than the reported _results_link

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

Commit Message

Michael-Doyle Hudson Feb. 10, 2013, 9:27 p.m.
------------------------------------------------------------
revno: 242
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Mon 2013-02-11 10:26:06 +1300
message:
  prefer getting the link from the results bundle rather than the reported _results_link
modified:
  lava_scheduler_app/models.py
  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

Patch

=== modified file 'lava_scheduler_app/models.py'
--- lava_scheduler_app/models.py	2013-01-30 01:31:16 +0000
+++ lava_scheduler_app/models.py	2013-02-10 21:26:06 +0000
@@ -359,10 +359,10 @@ 
 
     @property
     def results_link(self):
-        if self._results_link:
+        if self._results_bundle:
+            return self._results_bundle.get_permalink()
+        elif self._results_link:
             return self._results_link
-        elif self._results_bundle:
-            return self._results_bundle.get_permalink()
         else:
             return None
 

=== modified file 'lava_scheduler_app/views.py'
--- lava_scheduler_app/views.py	2013-01-30 08:31:57 +0000
+++ lava_scheduler_app/views.py	2013-02-10 21:26:06 +0000
@@ -769,7 +769,7 @@ 
     job = get_restricted_job(request.user, pk)
     json_text = simplejson.dumps({
         'status': job.get_status_display(),
-        'results_link': job.results_link,
+        'results_link': request.build_absolute_uri(job.results_link),
         })
     content_type = 'application/json'
     if 'callback' in request.GET: