> the friends is a sub-list of memory entity.
> Why not load the list on lazy mode.
>
> Faint, I will manual get the lists .
> But how can I put the sub-list to the object.
>
> does google provide sample code on this.
It's Python, you can create a member variable dynamically any time by
assigning to it:
memory.fetched_friends = my_fetched_entities
I suggest caching the friend entities in a dictionary to avoid
fetching the same one multiple times:
memories = Memory.all().order('-date').fetch(limit=X)
friends = {}
for memory in memories:
memory.fetched_friends = []
for friend_key in memory.friends:
if not friend_key in friends:
friends[friend_key] = Friends.get(friend_key)
memory.fetched_friends.append(friends[friend_key])
You can better this code by passing an array of keys to Friends.get()
to fetch all friend entities at once.
--
Get notified when artists you like release new albums
http://www.muspy.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---