| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 from collections import defaultdict | 5 from collections import defaultdict |
| 6 import copy | 6 import copy |
| 7 from datetime import datetime | 7 from datetime import datetime |
| 8 | 8 |
| 9 from google.appengine.api import users | 9 from google.appengine.api import users |
| 10 | 10 |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 if build: | 390 if build: |
| 391 cl['status'] = build['status'] | 391 cl['status'] = build['status'] |
| 392 cl['confidence'] = _GetConfidenceScore(cl_confidences, build) | 392 cl['confidence'] = _GetConfidenceScore(cl_confidences, build) |
| 393 | 393 |
| 394 return suspected_cls | 394 return suspected_cls |
| 395 | 395 |
| 396 | 396 |
| 397 class BuildFailure(BaseHandler): | 397 class BuildFailure(BaseHandler): |
| 398 PERMISSION_LEVEL = Permission.ANYONE | 398 PERMISSION_LEVEL = Permission.ANYONE |
| 399 | 399 |
| 400 def _ShowDebugInfo(self): | |
| 401 # Show debug info only if the app is run locally during development, if the | |
| 402 # currently logged-in user is an admin, or if it is explicitly requested | |
| 403 # with parameter 'debug=1'. | |
| 404 return users.is_current_user_admin() or self.request.get('debug') == '1' | |
| 405 | |
| 406 def _ShowTriageHelpButton(self): | 400 def _ShowTriageHelpButton(self): |
| 407 return users.is_current_user_admin() | 401 return users.is_current_user_admin() |
| 408 | 402 |
| 409 def _PrepareCommonDataForFailure(self, analysis): | 403 def _PrepareCommonDataForFailure(self, analysis): |
| 410 return { | 404 return { |
| 411 'master_name': analysis.master_name, | 405 'master_name': analysis.master_name, |
| 412 'builder_name': analysis.builder_name, | 406 'builder_name': analysis.builder_name, |
| 413 'build_number': analysis.build_number, | 407 'build_number': analysis.build_number, |
| 414 'pipeline_status_path': analysis.pipeline_status_path, | 408 'pipeline_status_path': analysis.pipeline_status_path, |
| 415 'show_debug_info': self._ShowDebugInfo(), | 409 'show_debug_info': self._ShowDebugInfo(), |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 else: | 498 else: |
| 505 self._PrepareDataForTestFailures( | 499 self._PrepareDataForTestFailures( |
| 506 analysis, build_info, data, self._ShowDebugInfo()) | 500 analysis, build_info, data, self._ShowDebugInfo()) |
| 507 return { | 501 return { |
| 508 'template': 'waterfall/test_failure.html', | 502 'template': 'waterfall/test_failure.html', |
| 509 'data': data | 503 'data': data |
| 510 } | 504 } |
| 511 | 505 |
| 512 def HandlePost(self): # pragma: no cover | 506 def HandlePost(self): # pragma: no cover |
| 513 return self.HandleGet() | 507 return self.HandleGet() |
| OLD | NEW |