OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 import calendar | |
6 | |
5 from google.appengine.ext import ndb | 7 from google.appengine.ext import ndb |
6 | 8 |
7 class Record(ndb.Model): | 9 class Record(ndb.Model): # pragma: no cover |
Sergey Berezin
2014/08/28 21:14:15
Why no cover? Is it just one line, or the whole cl
alancutter (OOO until 2018)
2014/08/29 01:38:36
Everything under appengine/ has "# pragma: no cove
| |
8 timestamp = ndb.DateTimeProperty(auto_now=True) | 10 timestamp = ndb.DateTimeProperty(auto_now=True) |
9 tags = ndb.StringProperty(repeated=True) | 11 tags = ndb.StringProperty(repeated=True) |
10 fields = ndb.JsonProperty(default={}) | 12 fields = ndb.JsonProperty(default={}) |
13 | |
14 def to_dict(self): | |
15 return { | |
16 'key': self.key.id() if type(self.key.id()) != long else None, | |
17 'timestamp': calendar.timegm(self.timestamp.timetuple()), | |
18 'tags': self.tags, | |
19 'fields': self.fields, | |
20 } | |
OLD | NEW |