Chromium Code Reviews| Index: appengine/findit/util_scripts/iterator.py |
| diff --git a/appengine/findit/util_scripts/iterator.py b/appengine/findit/util_scripts/iterator.py |
| index c57809a0244c6e4141658b1699cb0400c8fbc059..0528f29993026d1f33096664f239c8de8752be5c 100644 |
| --- a/appengine/findit/util_scripts/iterator.py |
| +++ b/appengine/findit/util_scripts/iterator.py |
| @@ -19,13 +19,13 @@ def ProjectEntity(entity, fields): |
| entity_info[field] = getattr(entity, field) |
| else: |
| entity_info[field] = None |
| - entity_info['id'] = entity.key.id() |
| + entity_info['id'] = entity.key.urlsafe() |
| return entity_info |
| def Iterate(query, |
| - fields, |
| app_id, |
| + fields=None, |
| filter_func=None, |
| batch_size=_DEFAULT_BATCH_SIZE, |
| batch_run=False): |
| @@ -33,10 +33,10 @@ def Iterate(query, |
| Args: |
| query (ndb.Query): The query to fetch entities. |
| + app_id (str): App engine app id. |
| fields (list): Field names of an entity to be projected to a dict. |
| If a given field name is not available, it is set to None. |
| - 'id' is always added by default as an integer. |
| - app_id (str): App engine app id. |
| + return complete entities. |
|
wrengr
2016/11/01 22:07:52
What do you mean "return complete entities." ?
Sharu Jiang
2016/11/11 23:10:26
I mean model instead of a projected dict.
|
| filter_func (function): A function that does in memory filtering. |
| batch_size (int): The number of entities to query at one time. |
| batch_run (bool): If True, iterate batches of entities, if |
| @@ -56,7 +56,9 @@ def Iterate(query, |
| if filter_func: |
| entities = filter_func(entities) |
| - entities = [ProjectEntity(entity, fields) for entity in entities] |
| + if fields: |
| + entities = [ProjectEntity(entity, fields) for entity in entities] |
| + |
| if batch_run: |
| yield entities |
| else: |