Chromium Code Reviews| 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 common.base_handler import BaseHandler | 9 from common.base_handler import BaseHandler |
| 10 from common.base_handler import Permission | 10 from common.base_handler import Permission |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 return False | 134 return False |
| 135 for trybot_config in builders.values(): | 135 for trybot_config in builders.values(): |
| 136 if not isinstance(trybot_config, dict): | 136 if not isinstance(trybot_config, dict): |
| 137 return False | 137 return False |
| 138 if (not trybot_config.get('mastername') or | 138 if (not trybot_config.get('mastername') or |
| 139 not trybot_config.get('buildername')): | 139 not trybot_config.get('buildername')): |
| 140 return False | 140 return False |
| 141 if (trybot_config.has_key('strict_regex') and | 141 if (trybot_config.has_key('strict_regex') and |
| 142 not isinstance(trybot_config['strict_regex'], bool)): | 142 not isinstance(trybot_config['strict_regex'], bool)): |
| 143 return False | 143 return False |
| 144 if (trybot_config.has_key('enable_tests') and | |
|
stgao
2016/04/16 01:04:04
Is seems we only want to set this field to disable
lijeffrey
2016/04/16 02:57:27
Done.
| |
| 145 not isinstance(trybot_config['enable_tests'], bool)): | |
| 146 return False | |
| 144 return True | 147 return True |
| 145 | 148 |
| 146 | 149 |
| 147 def _ValidateTryJobSettings(settings): | 150 def _ValidateTryJobSettings(settings): |
| 148 return (isinstance(settings, dict) and | 151 return (isinstance(settings, dict) and |
| 149 isinstance(settings.get('server_query_interval_seconds'), int) and | 152 isinstance(settings.get('server_query_interval_seconds'), int) and |
| 150 isinstance(settings.get('job_timeout_hours'), int) and | 153 isinstance(settings.get('job_timeout_hours'), int) and |
| 151 isinstance(settings.get('allowed_response_error_times'), int)) | 154 isinstance(settings.get('allowed_response_error_times'), int)) |
| 152 | 155 |
| 153 | 156 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 new_config_dict = json.loads(data) | 246 new_config_dict = json.loads(data) |
| 244 if not _ConfigurationDictIsValid(new_config_dict): # pragma: no cover | 247 if not _ConfigurationDictIsValid(new_config_dict): # pragma: no cover |
| 245 return self.CreateError( | 248 return self.CreateError( |
| 246 'New configuration settings is not properly formatted.', 400) | 249 'New configuration settings is not properly formatted.', 400) |
| 247 | 250 |
| 248 wf_config.FinditConfig.Get().Update(users.get_current_user(), | 251 wf_config.FinditConfig.Get().Update(users.get_current_user(), |
| 249 users.IsCurrentUserAdmin(), | 252 users.IsCurrentUserAdmin(), |
| 250 **new_config_dict) | 253 **new_config_dict) |
| 251 | 254 |
| 252 return self.HandleGet() | 255 return self.HandleGet() |
| OLD | NEW |