Exemple #1
0
def special_common_friends_with(index):
    """List all common friends to other person (i.e. using query parameter `index_other`) which have brown eyes and are still alive."""
    person = Person.objects(index=index).first()
    if not person:
        raise ValueError('Person not found')
    if not 'index_other' in request.args:
        raise ValueError('Must provide other person to match')
    other_person = Person.objects(index=request.args['index_other']).first()
    if not other_person:
        raise ValueError('Other person not found')
    return mongo_to_json(person.special_common_friends_with(other_person))
Exemple #2
0
def diet_preferences(index):
    """List diet preferences for fruit and vegetables for a person"""
    person = Person.objects(index=index).first()
    if not person:
        raise ValueError('Person not found')
    return mongo_to_json(person.diet_preferences())