| 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 fracas crash analysis result.""" | 5 """This module is to handle manual triage of fracas crash analysis result.""" |
| 6 | 6 |
| 7 import json | 7 import json |
| 8 | 8 |
| 9 from google.appengine.api import users | 9 from google.appengine.api import users |
| 10 from google.appengine.ext import ndb | 10 from google.appengine.ext import ndb |
| 11 | 11 |
| 12 from common.base_handler import BaseHandler | 12 from common.base_handler import BaseHandler |
| 13 from common.base_handler import Permission | 13 from common.base_handler import Permission |
| 14 from lib import time_util | 14 from libs import time_util |
| 15 from model import triage_status | 15 from model import triage_status |
| 16 from model.crash.fracas_crash_analysis import FracasCrashAnalysis | 16 from model.crash.fracas_crash_analysis import FracasCrashAnalysis |
| 17 | 17 |
| 18 | 18 |
| 19 @ndb.transactional | 19 @ndb.transactional |
| 20 def _UpdateAnalysis(key, user_name, update_data): | 20 def _UpdateAnalysis(key, user_name, update_data): |
| 21 analysis = key.get() | 21 analysis = key.get() |
| 22 success = analysis.Update(update_data) | 22 success = analysis.Update(update_data) |
| 23 | 23 |
| 24 result_property = None | 24 result_property = None |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 if not update_data: | 59 if not update_data: |
| 60 return {'data': {'success': False}} | 60 return {'data': {'success': False}} |
| 61 | 61 |
| 62 update_data = json.loads(update_data) | 62 update_data = json.loads(update_data) |
| 63 # As the permission level is CORP_USER, we could assume the current user | 63 # As the permission level is CORP_USER, we could assume the current user |
| 64 # already logged in. | 64 # already logged in. |
| 65 user_name = users.get_current_user().email().split('@')[0] | 65 user_name = users.get_current_user().email().split('@')[0] |
| 66 success = _UpdateAnalysis(key, user_name, update_data) | 66 success = _UpdateAnalysis(key, user_name, update_data) |
| 67 | 67 |
| 68 return {'data': {'success': success}} | 68 return {'data': {'success': success}} |
| OLD | NEW |