| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 """Handles requests to the findit config page.""" | 5 """Handles requests to the findit config page.""" |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 | 8 |
| 9 from base_handler import BaseHandler | 9 from base_handler import BaseHandler |
| 10 from base_handler import Permission | 10 from base_handler import Permission |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 return False | 129 return False |
| 130 for builders in builders_to_trybots.values(): | 130 for builders in builders_to_trybots.values(): |
| 131 if not isinstance(builders, dict): | 131 if not isinstance(builders, dict): |
| 132 return False | 132 return False |
| 133 for trybot_config in builders.values(): | 133 for trybot_config in builders.values(): |
| 134 if not isinstance(trybot_config, dict): | 134 if not isinstance(trybot_config, dict): |
| 135 return False | 135 return False |
| 136 if (not trybot_config.get('mastername') or | 136 if (not trybot_config.get('mastername') or |
| 137 not trybot_config.get('buildername')): | 137 not trybot_config.get('buildername')): |
| 138 return False | 138 return False |
| 139 if (trybot_config.has_key('strict_regex') and |
| 140 not isinstance(trybot_config['strict_regex'], bool)): |
| 141 return False |
| 139 return True | 142 return True |
| 140 | 143 |
| 141 | 144 |
| 142 def _ValidateTryJobSettings(settings): | 145 def _ValidateTryJobSettings(settings): |
| 143 return (isinstance(settings, dict) and | 146 return (isinstance(settings, dict) and |
| 144 isinstance(settings.get('server_query_interval_seconds'), int) and | 147 isinstance(settings.get('server_query_interval_seconds'), int) and |
| 145 isinstance(settings.get('job_timeout_hours'), int) and | 148 isinstance(settings.get('job_timeout_hours'), int) and |
| 146 isinstance(settings.get('allowed_response_error_times'), int)) | 149 isinstance(settings.get('allowed_response_error_times'), int)) |
| 147 | 150 |
| 148 | 151 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 def HandlePost(self): | 239 def HandlePost(self): |
| 237 data = self.request.params.get('data') | 240 data = self.request.params.get('data') |
| 238 new_config_dict = json.loads(data) | 241 new_config_dict = json.loads(data) |
| 239 if not _ConfigurationDictIsValid(new_config_dict): # pragma: no cover | 242 if not _ConfigurationDictIsValid(new_config_dict): # pragma: no cover |
| 240 return self.CreateError( | 243 return self.CreateError( |
| 241 'New configuration settings is not properly formatted.', 400) | 244 'New configuration settings is not properly formatted.', 400) |
| 242 | 245 |
| 243 wf_config.FinditConfig.Get().Update(**new_config_dict) | 246 wf_config.FinditConfig.Get().Update(**new_config_dict) |
| 244 | 247 |
| 245 return self.HandleGet() | 248 return self.HandleGet() |
| OLD | NEW |