Chromium Code Reviews| Index: appengine/findit/model/crash/crash_analysis.py |
| diff --git a/appengine/findit/model/crash/crash_analysis.py b/appengine/findit/model/crash/crash_analysis.py |
| index 4ae65cc0ee36303f095464282589ab9440331207..d48ffba7ad455be92ebd4cb2728de9b6eb6a9525 100644 |
| --- a/appengine/findit/model/crash/crash_analysis.py |
| +++ b/appengine/findit/model/crash/crash_analysis.py |
| @@ -1,6 +1,8 @@ |
| # 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. |
| +import json |
| +import logging |
| from google.appengine.ext import ndb |
| @@ -72,13 +74,13 @@ class CrashAnalysis(ndb.Model): |
| suspected_project_triage_status = ndb.IntegerProperty( |
| indexed=True, default=triage_status.UNTRIAGED) |
| - culprit_project = ndb.JsonProperty(indexed=False, default='') |
| + culprit_project = ndb.StringProperty(indexed=False, default='') |
| suspected_components_triage_status = ndb.IntegerProperty( |
| indexed=True, default=triage_status.UNTRIAGED) |
| culprit_components = ndb.JsonProperty(indexed=False, default=[]) |
| - triage_history = ndb.JsonProperty(indexed=False) |
| + triage_history = ndb.JsonProperty(indexed=False, default=[]) |
|
stgao
2016/06/30 01:28:02
We'd better not "hard-code" [] as the default valu
Sharu Jiang
2016/07/01 22:05:48
Done.
|
| # Triage note. |
| note = ndb.StringProperty(indexed=False, default='') |
| @@ -105,6 +107,19 @@ class CrashAnalysis(ndb.Model): |
| self.triage_history = None |
| self.note = '' |
| + def Update(self, update): |
| + try: |
| + for key, value in update.iteritems(): |
| + if not hasattr(self, key): |
| + continue |
| + |
| + setattr(self, key, value) |
| + |
| + return True |
| + except Exception: # pragma: no cover. |
|
stgao
2016/06/30 01:28:02
Why there will be exceptions here? What kinds of e
Sharu Jiang
2016/07/01 22:05:48
Just want to return False somehow, changed it to i
|
| + logging.warning('Failed to update %s' % json.dumps(update)) |
| + return False |
| + |
| @property |
| def completed(self): |
| return self.status in ( |