[LNT] r307216 - Give 404 when accessing invalid machine ID from this page
Chris Matthews via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 5 15:28:30 PDT 2017
Author: cmatthews
Date: Wed Jul 5 15:28:30 2017
New Revision: 307216
URL: http://llvm.org/viewvc/llvm-project?rev=307216&view=rev
Log:
Give 404 when accessing invalid machine ID from this page
Modified:
lnt/trunk/lnt/server/ui/views.py
Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=307216&r1=307215&r2=307216&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Wed Jul 5 15:28:30 2017
@@ -272,7 +272,10 @@ def v4_machine(id):
if request.args.get('json'):
json_obj = dict()
- machine_obj = ts.query(ts.Machine).filter(ts.Machine.id == id).one()
+ try:
+ machine_obj = ts.query(ts.Machine).filter(ts.Machine.id == id).one()
+ except NoResultFound:
+ abort(404)
json_obj['name'] = machine_obj.name
json_obj['id'] = machine_obj.id
json_obj['runs'] = []
More information about the llvm-commits
mailing list