| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 """This module is to handle manual triage of a suspected CL. | 5 """This module is to handle manual triage of a suspected CL. |
| 6 | 6 |
| 7 This handler will flag the suspected cl as correct or incorrect. | 7 This handler will flag the suspected cl as correct or incorrect. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 from google.appengine.api import users | 10 from google.appengine.api import users |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 if success: | 135 if success: |
| 136 _AppendTriageHistoryRecord( | 136 _AppendTriageHistoryRecord( |
| 137 master_name, builder_name, build_number, cl_info, cl_status, user_name) | 137 master_name, builder_name, build_number, cl_info, cl_status, user_name) |
| 138 | 138 |
| 139 return success | 139 return success |
| 140 | 140 |
| 141 | 141 |
| 142 class TriageSuspectedCl(BaseHandler): | 142 class TriageSuspectedCl(BaseHandler): |
| 143 PERMISSION_LEVEL = Permission.CORP_USER | 143 PERMISSION_LEVEL = Permission.CORP_USER |
| 144 LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET = False |
| 144 | 145 |
| 145 def HandleGet(self): # pragma: no cover | 146 def HandleGet(self): # pragma: no cover |
| 146 """Sets the manual triage result for the cl.""" | 147 """Sets the manual triage result for the cl.""" |
| 147 url = self.request.get('url').strip() | 148 url = self.request.get('url').strip() |
| 148 build_info = buildbot.ParseBuildUrl(url) | 149 build_info = buildbot.ParseBuildUrl(url) |
| 149 if not build_info: | 150 if not build_info: |
| 150 return {'data': {'success': False}} | 151 return {'data': {'success': False}} |
| 151 master_name, builder_name, build_number = build_info | 152 master_name, builder_name, build_number = build_info |
| 152 | 153 |
| 153 cl_status = int(self.request.get('status')) | 154 cl_status = int(self.request.get('status')) |
| 154 cl_info = self.request.get('cl_info') | 155 cl_info = self.request.get('cl_info') |
| 155 # As the permission level is CORP_USER, we could assume the current user | 156 # As the permission level is CORP_USER, we could assume the current user |
| 156 # already logged in. | 157 # already logged in. |
| 157 user_name = users.get_current_user().email().split('@')[0] | 158 user_name = users.get_current_user().email().split('@')[0] |
| 158 success = _UpdateSuspectedCLAndAnalysis( | 159 success = _UpdateSuspectedCLAndAnalysis( |
| 159 master_name, builder_name, build_number, cl_info, cl_status, user_name) | 160 master_name, builder_name, build_number, cl_info, cl_status, user_name) |
| 160 | 161 |
| 161 return {'data': {'success': success}} | 162 return {'data': {'success': success}} |
| 162 | 163 |
| 163 | 164 |
| 164 def HandlePost(self): # pragma: no cover | 165 def HandlePost(self): # pragma: no cover |
| 165 return self.HandleGet() | 166 return self.HandleGet() |
| OLD | NEW |