Chromium Code Reviews| 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 flake result. | 5 """This module is to handle manual triage of a suspected flake result. |
| 6 | 6 |
| 7 This handler will mark the suspected flake result as correct or incorrect. | 7 This handler will mark the suspected flake result as correct or incorrect. |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 from google.appengine.api import users | 10 from google.appengine.api import users |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 master_flake_analysis.put() | 33 master_flake_analysis.put() |
| 34 return True | 34 return True |
| 35 | 35 |
| 36 | 36 |
| 37 class TriageFlakeAnalysis(BaseHandler): | 37 class TriageFlakeAnalysis(BaseHandler): |
| 38 PERMISSION_LEVEL = Permission.CORP_USER | 38 PERMISSION_LEVEL = Permission.CORP_USER |
| 39 LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET = False | 39 LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET = False |
| 40 | 40 |
| 41 def HandleGet(self): # pragma: no cover | 41 def HandleGet(self): # pragma: no cover |
| 42 """Sets the manual triage result for the suspected flake analysis.""" | 42 """Sets the manual triage result for the suspected flake analysis.""" |
| 43 flake_info = self.request.get('flake_info') | 43 master_name = self.request.get('master_name').strip() |
| 44 (master_name, builder_name, build_number, step_name, test_name, | 44 builder_name = self.request.get('builder_name').strip() |
| 45 version_number, suspected_build_number) = flake_info.split('/') | 45 build_number = self.request.get('build_number').strip() |
| 46 step_name = self.request.get('step_name').strip() | |
| 47 test_name = self.request.get('test_name').strip() | |
| 48 version_number = self.request.get('version_number').strip() | |
|
stgao
2016/12/07 20:12:50
Would it be easier if we use the key.urlsafe() jus
chanli
2016/12/07 20:56:12
Agreed.
lijeffrey
2016/12/07 22:02:03
That's much cleaner! Done.
| |
| 49 suspected_build_number = self.request.get('suspected_build_number').strip() | |
| 46 triage_result = self.request.get('triage_result') | 50 triage_result = self.request.get('triage_result') |
| 47 | 51 |
| 48 if not (master_name and builder_name and build_number and step_name and | 52 if not (master_name and builder_name and build_number and step_name and |
| 49 test_name and version_number and suspected_build_number and | 53 test_name and version_number and suspected_build_number and |
| 50 str(triage_result)): | 54 str(triage_result)): |
| 51 # All fields needed for getting master_flake_analysis must be provided in | 55 # All fields needed for getting master_flake_analysis must be provided in |
| 52 # order to update triage results. | 56 # order to update triage results. |
| 53 return {'data': {'success': False}} | 57 return {'data': {'success': False}} |
| 54 | 58 |
| 55 # As the permission level is CORP_USER, we could assume the current user | 59 # As the permission level is CORP_USER, we could assume the current user |
| 56 # already logged in. | 60 # already logged in. |
| 57 user_name = users.get_current_user().email().split('@')[0] | 61 user_name = users.get_current_user().email().split('@')[0] |
| 58 | 62 |
| 59 success = _UpdateSuspectedFlakeAnalysis( | 63 success = _UpdateSuspectedFlakeAnalysis( |
| 60 master_name, builder_name, build_number, step_name, test_name, | 64 master_name, builder_name, build_number, step_name, test_name, |
| 61 int(version_number), suspected_build_number, int(triage_result), | 65 int(version_number), suspected_build_number, int(triage_result), |
| 62 user_name) | 66 user_name) |
| 63 | 67 |
| 64 return {'data': {'success': success}} | 68 return {'data': {'success': success}} |
| 65 | 69 |
| 66 def HandlePost(self): # pragma: no cover | 70 def HandlePost(self): # pragma: no cover |
| 67 return self.HandleGet() | 71 return self.HandleGet() |
| OLD | NEW |