[LNT] r258371 - On bad request, 404

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 20 16:14:22 PST 2016


Author: cmatthews
Date: Wed Jan 20 18:14:21 2016
New Revision: 258371

URL: http://llvm.org/viewvc/llvm-project?rev=258371&view=rev
Log:
On bad request, 404

Modified:
    lnt/trunk/lnt/server/ui/regression_views.py

Modified: lnt/trunk/lnt/server/ui/regression_views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/regression_views.py?rev=258371&r1=258370&r2=258371&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/regression_views.py (original)
+++ lnt/trunk/lnt/server/ui/regression_views.py Wed Jan 20 18:14:21 2016
@@ -18,6 +18,7 @@ from lnt.server.ui.globals import db_url
 from random import randint
 from sqlalchemy import desc, asc
 import sqlalchemy
+from sqlalchemy.orm.exc import NoResultFound
 from lnt.server.ui.util import FLASH_DANGER, FLASH_INFO, FLASH_SUCCESS
 from lnt.server.reporting.analysis import REGRESSED
 from wtforms import SelectMultipleField, StringField, widgets, SelectField
@@ -217,10 +218,12 @@ def v4_regression_detail(id):
     ts = request.get_testsuite()
     form = EditRegressionForm(request.form)
 
-    regression_info = ts.query(ts.Regression) \
-        .filter(ts.Regression.id == id) \
-        .one()
-
+    try:
+        regression_info = ts.query(ts.Regression) \
+            .filter(ts.Regression.id == id) \
+            .one()
+    except NoResultFound as e:
+        abort(404)
     if request.method == 'POST' and request.form['save_btn'] == "Save Changes":
         regression_info.title = form.title.data
         regression_info.bug = form.bug.data
@@ -315,6 +318,9 @@ def v4_make_regression(machine_id, test_
         filter(ts.Run.machine_id == run.machine_id). \
         all()
         
+    if len(runs) == 0:
+        abort(404)
+        
     previous_runs = ts.get_previous_runs_on_machine(run, 1)
     
     # Find our start/end order.




More information about the llvm-commits mailing list