Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 from google.appengine.ext import ndb | |
| 6 | |
| 7 from common import constants | |
| 8 from common import time_util | |
| 9 from common.base_handler import BaseHandler | |
| 10 from common.base_handler import Permission | |
| 11 | |
| 12 | |
| 13 class FracasResultFeedback(BaseHandler): | |
| 14 PERMISSION_LEVEL = Permission.CORP_USER | |
| 15 | |
| 16 def HandleGet(self): | |
| 17 """Gets the analysis and feedback triage result of a crash. | |
| 18 | |
| 19 Serve HTML page or JSON result as requested. | |
| 20 """ | |
| 21 key = ndb.Key(urlsafe=self.request.get('key')) | |
| 22 | |
| 23 analysis = key.get() | |
| 24 if not analysis: # pragma: no cover. | |
| 25 return BaseHandler.CreateError( | |
| 26 'cannot find analysis for crash %s' % analysis.signature) | |
|
stgao
2016/06/23 07:48:55
Will an unexpected exception be raised here?
Sharu Jiang
2016/06/23 20:18:35
Ouch, done.
| |
| 27 | |
| 28 data = { | |
| 29 'signature': analysis.signature, | |
| 30 'version': analysis.crashed_version, | |
| 31 'channel': analysis.channel, | |
| 32 'platform': analysis.platform, | |
| 33 'regression_range': analysis.result.get('regression_range', None), | |
|
stgao
2016/06/23 07:48:55
Could be even simplified by: dict_var.get('key')
Sharu Jiang
2016/06/23 20:18:35
Done.
| |
| 34 'historical_metadata': analysis.historical_metadata, | |
| 35 'stack_trace': analysis.stack_trace, | |
| 36 'suspected_cls': analysis.result.get('suspected_cls', None), | |
| 37 'suspected_project': analysis.result.get('suspected_project', None), | |
| 38 'suspected_components': analysis.result.get('suspected_components', | |
| 39 None), | |
| 40 'request_time': time_util.FormatDatetime(analysis.requested_time), | |
| 41 'analysis_completed': analysis.completed, | |
| 42 'analysis_failed': analysis.failed, | |
| 43 } | |
| 44 | |
| 45 return { | |
| 46 'template': 'crash/fracas_result_feedback.html', | |
| 47 'data': data, | |
| 48 } | |
| 49 | |
| 50 def HandlePost(self): # pragma: no cover | |
|
stgao
2016/06/23 07:48:55
This is not needed.
Sharu Jiang
2016/06/23 20:18:35
Done.
| |
| 51 return self.HandleGet() | |
| OLD | NEW |