| OLD | NEW |
| 1 # coding: utf-8 | 1 # coding: utf-8 |
| 2 # Copyright 2015 The LUCI Authors. All rights reserved. | 2 # Copyright 2015 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed by the Apache v2.0 license that can be | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """Packing and unpacking of ndb.Key. | 6 """Packing and unpacking of ndb.Key. |
| 7 | 7 |
| 8 End users are only given packed keys, which permits to not expose internal | 8 End users are only given packed keys, which permits to not expose internal |
| 9 schema details to the user. | 9 schema details to the user. |
| 10 """ | 10 """ |
| 11 | 11 |
| 12 from google.appengine.ext import ndb | 12 from google.appengine.ext import ndb |
| 13 | 13 |
| 14 from components import datastore_utils | 14 from components import datastore_utils |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 """Returns the TaskRunResult ndb.Key from a packed key. | 167 """Returns the TaskRunResult ndb.Key from a packed key. |
| 168 | 168 |
| 169 The expected format of |packed_key| is %x. | 169 The expected format of |packed_key| is %x. |
| 170 """ | 170 """ |
| 171 request_key = unpack_request_key(packed_key[:-1]) | 171 request_key = unpack_request_key(packed_key[:-1]) |
| 172 run_id = int(packed_key[-1], 16) | 172 run_id = int(packed_key[-1], 16) |
| 173 if not run_id: | 173 if not run_id: |
| 174 raise ValueError('Can\'t reference to the overall task result.') | 174 raise ValueError('Can\'t reference to the overall task result.') |
| 175 result_summary_key = request_key_to_result_summary_key(request_key) | 175 result_summary_key = request_key_to_result_summary_key(request_key) |
| 176 return result_summary_key_to_run_result_key(result_summary_key, run_id) | 176 return result_summary_key_to_run_result_key(result_summary_key, run_id) |
| OLD | NEW |