[LNT] r294043 - Use flashes to report errors in page settings to user

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 13:21:12 PST 2017


Author: cmatthews
Date: Fri Feb  3 15:21:12 2017
New Revision: 294043

URL: http://llvm.org/viewvc/llvm-project?rev=294043&view=rev
Log:
Use flashes to report errors in page settings to user

These 404s were used before we had good flash support. Now we can easily
report errors that way, so update these sites.

Modified:
    lnt/trunk/lnt/server/reporting/runs.py
    lnt/trunk/lnt/server/ui/views.py

Modified: lnt/trunk/lnt/server/reporting/runs.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/reporting/runs.py?rev=294043&r1=294042&r2=294043&view=diff
==============================================================================
--- lnt/trunk/lnt/server/reporting/runs.py (original)
+++ lnt/trunk/lnt/server/reporting/runs.py Fri Feb  3 15:21:12 2017
@@ -6,6 +6,8 @@ import time
 import lnt.server.reporting.analysis
 import lnt.server.ui.app
 import lnt.util.stats
+from flask import flash
+from lnt.server.ui.util import FLASH_INFO
 
 
 def generate_run_report(run, baseurl, only_html_body=False,
@@ -28,7 +30,6 @@ def generate_run_report(run, baseurl, on
     ts = run.testsuite
     machine = run.machine
     machine_parameters = machine.parameters
-    
 
     if baseline is None:
         # If a baseline has not been given, look up the run closest to
@@ -38,6 +39,8 @@ def generate_run_report(run, baseurl, on
     
     # If the baseline is the same as the comparison run, ignore it.
     if baseline is compare_to:
+        flash("Baseline and compare_to are the same: disabling baseline.",
+              FLASH_INFO)
         baseline = None
 
     # Gather the runs to use for statistical data.

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=294043&r1=294042&r2=294043&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Fri Feb  3 15:21:12 2017
@@ -279,13 +279,13 @@ class V4RequestInfo(object):
             self.compare_to = ts.query(ts.Run).\
                 filter_by(id=compare_to_id).first()
             if self.compare_to is None:
-                # FIXME: Need better way to report this error.
-                abort(404)
-
-            self.comparison_neighboring_runs = (
-                list(ts.get_next_runs_on_machine(self.compare_to, N=3))[::-1] +
-                [self.compare_to] +
-                list(ts.get_previous_runs_on_machine(self.compare_to, N=3)))
+                flash("Comparison Run is invalid: " + compare_to_str,
+                      FLASH_DANGER)
+            else:
+                self.comparison_neighboring_runs = (
+                    list(ts.get_next_runs_on_machine(self.compare_to, N=3))[::-1] +
+                    [self.compare_to] +
+                    list(ts.get_previous_runs_on_machine(self.compare_to, N=3)))
         else:
             if prev_runs:
                 self.compare_to = prev_runs[0]
@@ -306,8 +306,7 @@ class V4RequestInfo(object):
             self.baseline = ts.query(ts.Run).\
                 filter_by(id=baseline_id).first()
             if self.baseline is None:
-                # FIXME: Need better way to report this error.
-                abort(404)
+                flash("Could not find baseline " + baseline_str, FLASH_DANGER)
         else:
             self.baseline = None
 




More information about the llvm-commits mailing list