Chromium Code Reviews| Index: appengine/findit/handlers/crash/fracas_result_feedback.py |
| diff --git a/appengine/findit/handlers/crash/fracas_result_feedback.py b/appengine/findit/handlers/crash/fracas_result_feedback.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..417b0521005a6dc8e6248bcd48adedc0b287dbdf |
| --- /dev/null |
| +++ b/appengine/findit/handlers/crash/fracas_result_feedback.py |
| @@ -0,0 +1,51 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from google.appengine.ext import ndb |
| + |
| +from common import constants |
| +from common import time_util |
| +from common.base_handler import BaseHandler |
| +from common.base_handler import Permission |
| + |
| + |
| +class FracasResultFeedback(BaseHandler): |
| + PERMISSION_LEVEL = Permission.CORP_USER |
| + |
| + def HandleGet(self): |
| + """Gets the analysis and feedback triage result of a crash. |
| + |
| + Serve HTML page or JSON result as requested. |
| + """ |
| + key = ndb.Key(urlsafe=self.request.get('key')) |
| + |
| + analysis = key.get() |
| + if not analysis: # pragma: no cover. |
| + return BaseHandler.CreateError( |
| + '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.
|
| + |
| + data = { |
| + 'signature': analysis.signature, |
| + 'version': analysis.crashed_version, |
| + 'channel': analysis.channel, |
| + 'platform': analysis.platform, |
| + '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.
|
| + 'historical_metadata': analysis.historical_metadata, |
| + 'stack_trace': analysis.stack_trace, |
| + 'suspected_cls': analysis.result.get('suspected_cls', None), |
| + 'suspected_project': analysis.result.get('suspected_project', None), |
| + 'suspected_components': analysis.result.get('suspected_components', |
| + None), |
| + 'request_time': time_util.FormatDatetime(analysis.requested_time), |
| + 'analysis_completed': analysis.completed, |
| + 'analysis_failed': analysis.failed, |
| + } |
| + |
| + return { |
| + 'template': 'crash/fracas_result_feedback.html', |
| + 'data': data, |
| + } |
| + |
| + 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.
|
| + return self.HandleGet() |