def get_face_from(face_id, update_views=False): ''' return a FacePictures obj from `face_id` ''' global FacePictures face = FacePictures.find_one({_FACE_ID: face_id}) if update_views: add_one_view_to(face) return face
def get_current_winner(from_cache=True): if not from_cache: global FacePictures return FacePictures.find_one(sort={'score': -1}, limit=1) return get_from_cache('winner')