Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: dashboard/dashboard/create_health_report.py

Issue 2648683004: Building the table for speed releasing. (Closed)
Patch Set: comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | dashboard/dashboard/create_health_report_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Provides the web interface for adding and editing sheriff rotations.""" 5 """Provides the web interface for adding and editing sheriff rotations."""
6 6
7 import logging
7 import json 8 import json
8 9
9 from google.appengine.api import users 10 from google.appengine.api import users
10 11
11 from dashboard.common import request_handler 12 from dashboard.common import request_handler
12 from dashboard.common import utils 13 from dashboard.common import utils
13 from dashboard.common import xsrf 14 from dashboard.common import xsrf
14 from dashboard.models import table_config 15 from dashboard.models import table_config
15 16
16 17
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 master_bot = self.request.get('tableBots').splitlines() 52 master_bot = self.request.get('tableBots').splitlines()
52 tests = self.request.get('tableTests').splitlines() 53 tests = self.request.get('tableTests').splitlines()
53 table_layout = self.request.get('tableLayout') 54 table_layout = self.request.get('tableLayout')
54 user = users.get_current_user() 55 user = users.get_current_user()
55 if not name or not master_bot or not tests or not table_layout or not user: 56 if not name or not master_bot or not tests or not table_layout or not user:
56 self.response.out.write(json.dumps({ 57 self.response.out.write(json.dumps({
57 'error': 'Please fill out the form entirely.' 58 'error': 'Please fill out the form entirely.'
58 })) 59 }))
59 return 60 return
60 61
61 created_table, msg = table_config.CreateTableConfig( 62 try:
62 name=name, bots=master_bot, tests=tests, layout=table_layout, 63 created_table = table_config.CreateTableConfig(
63 username=user.email()) 64 name=name, bots=master_bot, tests=tests, layout=table_layout,
65 username=user.email())
66 except table_config.BadRequestError as error:
67 self.response.out.write(json.dumps({
68 'error': error.message,
69 }))
70 logging.error(error.message)
71 return
72
64 73
65 if created_table: 74 if created_table:
66 self.response.out.write(json.dumps({ 75 self.response.out.write(json.dumps({
67 'name': name, 76 'name': name,
68 })) 77 }))
69 else: 78 else:
70 self.response.out.write(json.dumps({ 79 self.response.out.write(json.dumps({
71 'error': msg, 80 'error': 'Could not create table.',
sullivan 2017/01/31 16:36:47 Should probably also log an error here. Imagine th
72 })) 81 }))
73 82
74 def _ValidateToken(self): 83 def _ValidateToken(self):
75 user = users.get_current_user() 84 user = users.get_current_user()
76 token = str(self.request.get('xsrf_token')) 85 token = str(self.request.get('xsrf_token'))
77 if not user or not xsrf._ValidateToken(token, user): 86 if not user or not xsrf._ValidateToken(token, user):
78 self.abort(403) 87 self.abort(403)
OLDNEW
« no previous file with comments | « no previous file | dashboard/dashboard/create_health_report_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698