OLD | NEW |
1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 The LUCI Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
3 # found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
4 | 4 |
5 """Json serializable properties.""" | 5 """Json serializable properties.""" |
6 | 6 |
7 from google.appengine.ext import ndb | 7 from google.appengine.ext import ndb |
8 from google.appengine.api import datastore_errors | 8 from google.appengine.api import datastore_errors |
9 | 9 |
10 from components import utils | 10 from components import utils |
11 | 11 |
12 | 12 |
13 __all__ = [ | 13 __all__ = [ |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 rich_to_simple=lambda prop, value: value.to_jsonish(), | 440 rich_to_simple=lambda prop, value: value.to_jsonish(), |
441 simple_to_rich=lambda prop, value: prop._value_type.from_jsonish(value)) | 441 simple_to_rich=lambda prop, value: prop._value_type.from_jsonish(value)) |
442 | 442 |
443 | 443 |
444 # Handles all property classes inherited from BytesSerializableProperty. | 444 # Handles all property classes inherited from BytesSerializableProperty. |
445 register_converter( | 445 register_converter( |
446 property_cls=BytesSerializableProperty, | 446 property_cls=BytesSerializableProperty, |
447 include_subclasses=True, | 447 include_subclasses=True, |
448 rich_to_simple=lambda prop, value: value.to_bytes(), | 448 rich_to_simple=lambda prop, value: value.to_bytes(), |
449 simple_to_rich=lambda prop, value: prop._value_type.from_bytes(value)) | 449 simple_to_rich=lambda prop, value: prop._value_type.from_bytes(value)) |
OLD | NEW |