Пример #1
0
def joinData(events):
    for event in events:
        creator = user.readById(event["createdBy"])
        gravatar = creator.get("gravatar")
        if gravatar != None:
            event["gravatar"] = gravatar
        event["userName"] = creator["userName"]
    return events
Пример #2
0
 def join(shift):
     id = shift["_id"]
     if userId:
         shift["favorite"] = isFavorited(id, userId)
     shift["favoriteCount"] = favoriteCount(id)
     streamId = commentStream(id)
     if streamId:
         shift["commentCount"] = len(event.eventsForStream(streamId))
     creator = user.readById(shift["createdBy"])
     gravatar = creator.get("gravatar")
     if gravatar != None:
         shift["gravatar"] = gravatar
     return shift