Index: appengine/chromium_cq_status/model/record.py |
diff --git a/appengine/chromium_cq_status/model/record.py b/appengine/chromium_cq_status/model/record.py |
index 33c55c5373d15f00dd122230fd011c9109326c0f..899248e36f9b2c7375fb826a706f5ea81471fd22 100644 |
--- a/appengine/chromium_cq_status/model/record.py |
+++ b/appengine/chromium_cq_status/model/record.py |
@@ -2,9 +2,19 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+from shared.utils import to_unix_timestamp |
+ |
from google.appengine.ext import ndb |
-class Record(ndb.Model): |
+class Record(ndb.Model): # pragma: no cover |
timestamp = ndb.DateTimeProperty(auto_now=True) |
tags = ndb.StringProperty(repeated=True) |
fields = ndb.JsonProperty(default={}) |
+ |
+ def to_dict(self): |
+ return { |
+ 'key': self.key.id() if type(self.key.id()) != long else None, |
+ 'timestamp': to_unix_timestamp(self.timestamp), |
+ 'tags': self.tags, |
+ 'fields': self.fields, |
+ } |